I can point you in the direction of one solution:
<img src="http://myapp/.getimage?img_code=123">
Create a servlet and map "*.getimage" to it in the web.xml file of your web application. Because struts normally looks for "*.do" it should not interfere with struts:
<servlet>
<servlet-name>getImage</servlet-name>
<servlet-class>com.myapp.GetImage</servlet-class><!-- the fully qualified classname of your servlet -->
</servlet>
<servlet-mapping>
<servlet-name>getImage</servlet-name>
<url-pattern>*.getimage</url-pattern>
</servlet-mapping>
in the doPost(..) method of your servlet, set the content type (where you would normally use "text/html") to "image/gif":
public class GetImage extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("image/gif");
PrintWriter out = response.getWriter();
/* read your image from the database, and use the PrintWriter to
write it to the response
*/
out.close();
}
}
You can find a list of subtypes
here for your specific format.