我有以下控制器方法,以成员补贴为基础,在共同财产计划中展示形象:
@RequestMapping(value="/artists/members/photo/{memberId}", method=RequestMethod.GET)
public void renderPhoto(
HttpServletResponse response,
@PathVariable("memberId") Integer memberId)
throws IOException {
Member member = memberService.loadMember(memberId);
byte[] photo = member.getPhoto();
response.setContentType("image/jpeg");
response.setContentLength(photo.length);
response.getOutputStream().write(photo);
response.getOutputStream().flush();
}
对每个成员来说,我要展示他的形象:
<c:forEach items="${members}" var="member">
<img src="${ctx}/artists/members/photo/<c:out value= ${member.memberId} />"></img>
</c:forEach>
但破碎的链接图像在浏览器中显示。 我在这里失踪了吗?