struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saeed Iqbal <saee...@gmail.com>
Subject Re: [Struts 2 + EJB 3] Display an image
Date Fri, 27 Nov 2009 11:55:32 GMT
Are you putting the file name in session string or the binary file?

On Friday, November 27, 2009, Fernandes Celinio
<cfernandes@sopragroup.com> 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 :
>
>     <s:property value="#session.boo.attributeN" /> <br />
>     <img src="<s:property value="#session.boo.image" />" /> <br />
>
> 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

-- 
Saeed Iqbal
http://www.iqbalconsulting.com
Struts - J2EE - Application Architect / Developer

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message