A nice design for an action such as this is to create a "BinaryRenderAction" which receives as request parameters the db reference of the image so it or soime business delegate/DAO can retrieve it, and a reference to the mime-type so that it can set the header in the response.
This way the action doesn't care what type of binary data it is rendering, all it does is get some binary data from the db using the reference suppplied and, then set the header in the response to the one that recieved as a parameter (or to the one that is stored on the row if you db schema is set that way) All it needs to do now is write the bytes to the ServletouputStream and return null in the perform() method and "Bobs you Uncle" a re-usable BinaryrenderAction that can be used any where on the site... HTH Jin ----- Original Message ----- From: "Olivier Dinocourt" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, January 09, 2002 9:15 AM Subject: Re: What is the best way to display pictures from a database usin g Struts > There's one important thing to do, too : don't forget to set the mime-type, > else it will be text/plain or text/html, and your browser will display your > byte stream as text.... > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Wednesday, January 09, 2002 6:40 PM > Subject: Re: What is the best way to display pictures from a database usin g > Struts > > > > It surely does help, I shall put it to work now! > > > > Cheers > > > > Tony > > > > Jesse Alexander (KABS 11) wrote: > > > > > Hi, > > > > > > from an Action's perform() you can do two things: > > > a) do something (usefull) and return an ActionForward-object > > > b) do somthing (usefull), write the desired output (html, pdf-stream, > > > image-bytes,...) to the response-objects output (just like standard > > > servlet-programming!) and return a NULL-object (return null) > > > in this case you want to use b). Important is returning null to indicate > > > that the Action did complete the processing. Else ActionServlet will > pass > > > on to the returned ActionForward-object... > > > > > > hope this helps > > > Alexander Jesse > > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>