图片展示struts
<action name="getDoctorImage" class="communityAction" method="getDoctorImage">
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">is</param>
<param name="bufferSize">4096</param>
</result>
</action>
图片展示Controller
private InputStream is;
private TbWebsiteCommunityDoctor tcd;
public String getDoctorImage() throws IOException{
List list=new ArrayList();
list=webService.findCommunityDepartDoctorDetail(Long.valueOf(doctorId));//通过id读取数据内容
tcd=(TbWebsiteCommunityDoctor)list.get(0);
byte[] image = (byte[]) tcd.getImage();//从中获取需要展示的图片
is = new ByteArrayInputStream(image);
return SUCCESS;
}
图片展示 jsp
<td colspan="2">
<div id="oldImage" class="new_wenzi">
<s:if test="dphotoImage.length != 0">
<img src="getTopDoctorImageCurrent.action?did=<s:property value="did"/>" align="absmiddle" />
</s:if>
</div>
</td>