You may want to write a separate servlet to serve the image data. That allows you to implement getLastModified() and allow proper browser-caching support, which can significantly increase the speed of your pages if the user is likely to view the images more than once. We did this with an Action first and since we had caching turned off, it reloaded the images every time. Switching to a separate servlet where we implemented getLastModified() was perceptably faster.
Perhaps Struts should allow Action-implementers to implement some kind of getLastModified() method for this reason. Or at least to turn caching on and off at the Action (or action-mapping) level. getLastModified() is really useful if you have the image data (or document data, etc.) stored in a db. -Max ----- Original Message ----- From: "Craig R. McClanahan" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, October 27, 2003 9:17 AM Subject: Re: specifying image source as jpg stream > Kris Schneider wrote: > > >Create an Action whose execute method writes the image data directly to the > >response's output stream and then returns null (you could also use a servlet or > >filter). > > > > > > > > Don't forget that, in HTML images are retrieved (by the client) in > *separate* requests. You can't intermix the text/html output of your > JSP page and the image/jpg binary content of the image on a single response. > > What you'd want to do, then is create an Action (as described above) > that writes the image data directly, and then arrange that your > <html:img> tag references this Action's URL. > > Craig > > > >Quoting Yoganarasimha G <[EMAIL PROTECTED]>: > > > > > > > >>Hi all > >> > >>I'm developing a webpage which uses xml to display organization chart. I'm > >>using SVG to display the chart in IE. If the user doesn't have SVG viewer I'm > >>converting SVG to JPG using BATIK. At present I'm creating a image file in a > >>temp folder and then displaying, but i want to avoid this and directly give > >>image stream as the source for <html:img> tag. Can anyone help me how to do > >>this using struts??? > >> > >>regards > >>Yoga > >> > >> > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]