How to display an image using tag in JSP

前提是你 提交于 2019-11-29 18:11:37

You should do it in struts 2 way by implementing a Custom Result Type to display image on the JSP.

Here is an Example for displaying dynamic image in Stuts2.

It creates a custom result type by implementing Result interface.

public class CustomImageBytesResult implements Result {
.
.
.
}
Roman C

After retrieving an image from the database as Blob or byte array you are writing direct to response. In this case you should not return SUCCESS result, you need to return NONE result. Then in the JSP you could access an image as a separate thread using img tag that will call your action that return an image.

See also How can we display dynamic or static images that can be provided as an array of bytes, and How to display image in Struts2.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!