RE: [Struts 2 + EJB 3] Display an image
Hi, Thanks for helping. Well, I of course needed to call the action in my tag. It works. Thanks again. -Message d'origine- De : Paweł Wielgus [mailto:poulw...@gmail.com] Envoyé : vendredi 27 novembre 2009 13:04 À : Struts Users Mailing List Objet : Re: [Struts 2 + EJB 3] Display an image Hi Fernandes, i think that it is impossible what You are trying to achieve. You cannot pur image to img tag inside html. Img tag will result in just another http request, and this another request must be serviced by your server. So the code will look like this: And showMyImage action will simply return image as a result. Also read very carrefully above e-mail from Saeed! Best greetings, Paweł Wielgus. 2009/11/27 Saeed Iqbal : > Are you putting the file name in session string or the binary file? > > On Friday, November 27, 2009, Fernandes Celinio > wrote: >> Hi, >> >> I have an entity bean which has a BLOB attribute. That BLOB attribute >> maps to a BLOB column in a table in an Oracle database. >> >> @Entity >> public class Boo implements Serializable { >> ... >> @Lob >> �...@basic(fetch=FetchType.LAZY) >> private byte[] image; >> >> public byte[] getImage() { >> return image; >> } >> >> public void setImage(byte[] image) { >> this.image = image; >> } >> >> ... >> } >> >> I also have an Action class where i query that entity bean and put >> the result into the session : >> >> public class MyAction extends ActionSupport implements SessionAware { >> ... >> Public String someMethod() throws Exception { >> >> Boo boo = blaRemote.findById(l); >> session.put("boo ", boo ); >> >> ... >> } >> >> >> Finally in my JSP i display the various values of the attributes of >> that Entity bean, including that image attribute : >> >> >> " /> >> >> Of course I can display the value of all attributes except the image. >> >> How do you display an image with Struts 2 ? Is there a specific tag >> for it ? >> >> Thanks for helping. >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > -- > Saeed Iqbal > http://www.iqbalconsulting.com > Struts - J2EE - Application Architect / Developer > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2 + EJB 3] Display an image
Hi Fernandes, i think that it is impossible what You are trying to achieve. You cannot pur image to img tag inside html. Img tag will result in just another http request, and this another request must be serviced by your server. So the code will look like this: And showMyImage action will simply return image as a result. Also read very carrefully above e-mail from Saeed! Best greetings, Paweł Wielgus. 2009/11/27 Saeed Iqbal : > Are you putting the file name in session string or the binary file? > > On Friday, November 27, 2009, Fernandes Celinio > wrote: >> Hi, >> >> I have an entity bean which has a BLOB attribute. That BLOB attribute >> maps to a BLOB column in a table in an Oracle database. >> >> @Entity >> public class Boo implements Serializable { >> ... >> @Lob >> �...@basic(fetch=FetchType.LAZY) >> private byte[] image; >> >> public byte[] getImage() { >> return image; >> } >> >> public void setImage(byte[] image) { >> this.image = image; >> } >> >> ... >> } >> >> I also have an Action class where i query that entity bean and put the >> result into the session : >> >> public class MyAction extends ActionSupport implements SessionAware { >> ... >> Public String someMethod() throws Exception { >> >> Boo boo = blaRemote.findById(l); >> session.put("boo ", boo ); >> >> ... >> } >> >> >> Finally in my JSP i display the various values of the attributes of that >> Entity bean, including that image attribute : >> >> >> " /> >> >> Of course I can display the value of all attributes except the image. >> >> How do you display an image with Struts 2 ? Is there a specific tag for >> it ? >> >> Thanks for helping. >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > -- > Saeed Iqbal > http://www.iqbalconsulting.com > Struts - J2EE - Application Architect / Developer > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2 + EJB 3] Display an image
Are you putting the file name in session string or the binary file? On Friday, November 27, 2009, Fernandes Celinio wrote: > Hi, > > I have an entity bean which has a BLOB attribute. That BLOB attribute > maps to a BLOB column in a table in an Oracle database. > > @Entity > public class Boo implements Serializable { > ... > @Lob > �...@basic(fetch=FetchType.LAZY) > private byte[] image; > > public byte[] getImage() { > return image; > } > > public void setImage(byte[] image) { > this.image = image; > } > > ... > } > > I also have an Action class where i query that entity bean and put the > result into the session : > > public class MyAction extends ActionSupport implements SessionAware { > ... > Public String someMethod() throws Exception { > > Boo boo = blaRemote.findById(l); > session.put("boo ", boo ); > > ... > } > > > Finally in my JSP i display the various values of the attributes of that > Entity bean, including that image attribute : > > > " /> > > Of course I can display the value of all attributes except the image. > > How do you display an image with Struts 2 ? Is there a specific tag for > it ? > > Thanks for helping. > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Saeed Iqbal http://www.iqbalconsulting.com Struts - J2EE - Application Architect / Developer - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[Struts 2 + EJB 3] Display an image
Hi, I have an entity bean which has a BLOB attribute. That BLOB attribute maps to a BLOB column in a table in an Oracle database. @Entity public class Boo implements Serializable { ... @Lob @Basic(fetch=FetchType.LAZY) private byte[] image; public byte[] getImage() { return image; } public void setImage(byte[] image) { this.image = image; } ... } I also have an Action class where i query that entity bean and put the result into the session : public class MyAction extends ActionSupport implements SessionAware { ... Public String someMethod() throws Exception { Boo boo = blaRemote.findById(l); session.put("boo ", boo ); ... } Finally in my JSP i display the various values of the attributes of that Entity bean, including that image attribute : " /> Of course I can display the value of all attributes except the image. How do you display an image with Struts 2 ? Is there a specific tag for it ? Thanks for helping. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org