Re: Struts2 and images from database

2007-07-18 Thread bartlebooth
Perhaps the result name in my example does not correspond to the return value of your action ? I assume you are using the param interceptor here public class ImageAction { privateint imageId; privateImage image; // this method is called when using the param-interceptor pu

Re: Struts2 and images from database

2007-07-18 Thread Roberto Nunnari
my fault.. action.execute() was still returning SUCCESS while the mapping result name is "all"! Thank you! -- Robi. Roberto Nunnari wrote: Hi bartlebooth. That is very neat! But the getImageStream method in my action is never called.. why? bartlebooth wrote: You could use the stream re

Re: Struts2 and images from database

2007-07-18 Thread Roberto Nunnari
Hi bartlebooth. That is very neat! But the getImageStream method in my action is never called.. why? bartlebooth wrote: You could use the stream result-type. image/jpg imageStream name="contentDisposition">filename="image.jpg"

Re: Struts2 and images from database

2007-07-18 Thread bartlebooth
You could use the stream result-type. image/jpg imageStream name="contentDisposition">filename="image.jpg" 1024 In your action, you have to provide a method getImageStream (corresponding to the inputName parame

Re: Struts2 and images from database

2007-07-18 Thread Roberto Nunnari
Thank you Josh! I'll try that right away.. I thought that struts actions could only return text.. Do you have to change the resultType for that action? -- Robi Josh Vickery wrote: If you return null from your Action you can write directly to the response: HttpServletResponse response = Serv

Re: Struts2 and images from database

2007-07-18 Thread Josh Vickery
If you return null from your Action you can write directly to the response: HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("image/jpg"); out = response.getOutputStream(); write image here return null; On 7/18/07, Roberto Nunnari <[EMAIL PROTECTED]> wro

Re: Struts2 and images from database

2007-07-18 Thread Roberto Nunnari
hehe.. ok.. let's add some context.. Till now I was using a servlet to serve to the web images stored in a database. To access the database I had the myDAO object in the applicationContext and so it was accessible by the servlet and actions. Now I have added Spring to the game, and the myDAO obj

Struts2 and images from database

2007-07-18 Thread Roberto Nunnari
Hello. What is the best way to serve images stored in database in Struts2? action, resultType, or servlet? Thank you. -- Robi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]