Calling a dynamic image servlet in a JSP page.

I have a servlet, MakeImage.java, as follows...

imports...

publicclass MakeImageextends HttpServlet{

publicvoid doGet(

HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException{

response.setContentType("image/jpeg");

// Create image

int width=500, height=300;

BufferedImage image =new BufferedImage(

width, height, BufferedImage.TYPE_INT_RGB);

. . .

// Dispose context

graph.dispose();

ServletOutputStream sos = response.getOutputStream();

JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);

encoder.encode(image);

}

}

I can run it by typing in its location in the address bar and the image is displayed. How do I call this servlet, or image, from a JSP page?

[1294 byte] By [SeniorProjecta] at [2007-10-2 16:12:56]
# 1
Hi,try the following <jsp:include page="Servlet here" flush="true" /> bye for nowsat
AnanSmritia at 2007-7-13 16:59:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
SeniorProject, don't cross post the same question in multiple forums.AnanSmriti: No, that is incorrect. That code is for including jsp pages - NOT images. http://forum.java.sun.com/thread.jspa?threadID=721993&messageID=4165741#4165741
evnafetsa at 2007-7-13 16:59:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Hi,i've posted u the same script in th jsp forum,it will work.<script type='text/javascript' language='javascript' src='MakeImage.js'></script>vj
vj2093a at 2007-7-13 16:59:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...