You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zaid <za...@cosmos-software.com> on 2004/05/07 15:14:56 UTC

Re: How to renderize a image?

Dear Paulo,

first of all, you need to make a jsp page (like photo.jsp) which will be
like this in your display page

<html:img src="photo.jsp?ID=3">

the photo.jsp will need to make the contentType to img/jpeg or any typem
extract the BLOB field from database and flush the content.

Regards,

zaid

----- Original Message ----- 
From: "Paulo Rezende" <ja...@pmbr.net>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, May 26, 2004 4:57 PM
Subject: How to renderize a image?


Friends,

I have a image in Oracle Blob field and i want to renderize it my jsp. Do I
need to use <hmtl:image> or <html:img> or this is not the way? My form
property is a Blob, but i guess that this tags dont support this class,
seemingly they support only a Map. Really I'm helping a friend, and I thank
so any help... Anybody could show me the way?

tks, Paulo


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


Re: How to renderize a image?

Posted by Mick Wever <ha...@netbeans.org>.
On Wed, 26 May 2004 10:26:34 -0300, Paulo Rezende wrote:
> It's a way but I really dont like it. If I copy all the fields of a table
> to properties of the form, why i dont can copy also the image to a Blob in
> the form and use it? Do I need to create another connection with db and
> run another sql only to get the image?

Yes you'll need separate db calls. Images are always separate urls and are
not 'embedded' into the html.
Your picture servlet will look something like below so it's not like there
is really a lot of extra work involved.

		
		String format = ...;
                byte[] data = ...;
                try{
                    response.reset();
                    response.setContentType(format);
                    ServletOutputStream ss = response.getOutputStream();
                    ss.write(data);
                    ss.close();
                }catch(IOException io){
                    LOG.error("PictureServlet.doGet "+io);
                }

Mick.

-- 
-- <BR/>
"As you go the way of life, you will see a great chasm. Jump. It is not as wide as you think." Native American Initiation Rite
<BR/> --- <a href=http://www.harryspractice.com.au>Harry's Practice</a> --- 



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


Re: How to renderize a image?

Posted by Paulo Rezende <ja...@pmbr.net>.
Zaid,

It's a way but I really dont like it. If I copy all the fields of a table to
properties of the form, why i dont can copy also the image to a Blob in the
form and use it? Do I need to create another connection with db and run
another sql only to get the image?

tks, Paulo

----- Original Message ----- 
From: "Zaid" <za...@cosmos-software.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, May 07, 2004 10:14 AM
Subject: Re: How to renderize a image?


> Dear Paulo,
>
> first of all, you need to make a jsp page (like photo.jsp) which will be
> like this in your display page
>
> <html:img src="photo.jsp?ID=3">
>
> the photo.jsp will need to make the contentType to img/jpeg or any typem
> extract the BLOB field from database and flush the content.
>
> Regards,
>
> zaid
>
> ----- Original Message ----- 
> From: "Paulo Rezende" <ja...@pmbr.net>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Wednesday, May 26, 2004 4:57 PM
> Subject: How to renderize a image?
>
>
> Friends,
>
> I have a image in Oracle Blob field and i want to renderize it my jsp. Do
I
> need to use <hmtl:image> or <html:img> or this is not the way? My form
> property is a Blob, but i guess that this tags dont support this class,
> seemingly they support only a Map. Really I'm helping a friend, and I
thank
> so any help... Anybody could show me the way?
>
> tks, Paulo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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