Take a look at http://struts.apache.org/2.x/docs/stream-result.html
On 16 May 2011 18:41, Ilya Kazakevich wrote:
> You need action (or servlet) that will read image from db and write image to
> the output stream setting appropriate conent-type.
> Than you do:
>
>
>
>
>
> Ilya Kazakevich,
> Devel
You need action (or servlet) that will read image from db and write image to
the output stream setting appropriate conent-type.
Than you do:
Ilya Kazakevich,
Developer
JetBrains Inc
http://www.jetbrains.com
"Develop with pleasure!"
-Original Message-
From: Saeed Najahi [mailto:najah
Stream it to the ServletOutputStream and return null from the action.
(*Chris*)
On May 16, 2011 8:48 AM, "Saeed Najahi" wrote:
> hello guys, can anyone kindly tell me how can i display an image fetched
> from a database using the tag? thanks in advance.
>
> --
>
e else?
M-
- Original Message -
From: "C. Grobmeier" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List"
Sent: Tuesday, July 25, 2006 9:55 AM
Subject: Re: Displaying images from database.
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> The
ssage -
> From: "C. Grobmeier" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List"
> Sent: Tuesday, July 25, 2006 9:55 AM
> Subject: Re: Displaying images from database.
>
>
> Then how can one have an Java-Object, let's say Person.java. Per
meier" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List"
Sent: Tuesday, July 25, 2006 9:55 AM
Subject: Re: Displaying images from database.
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Then how can one have an Java-Object, let's say Person.java. Person
awful. If you are not the intended recipient of the mail, kindly
> intimate the author of the mail and delete the same.
>
>
> - Original Message -
> From: [EMAIL PROTECTED]
>
PROTECTED]
To: user@struts.apache.org
Sent: Tuesday, July 25, 2006 6:37 PM
Subject: RE: Displaying images from database.
Hi David
Thanks for a prompt response.
But I also want to display other things on the jsp page besides the
image.
For e.g.
My jsp page would have
Say if all request for images will refer to the same action like
image.do, then
So map this to a particular action.
Set the content type and write the image content to the ServletOutputStream
return null for ActionForward.
The snippet below should give you an idea.
Consider if resource.getResour
and save the changes made
How can I achieve this?
Thanks & Regards
Prerna
-Original Message-
From: David Soler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 25, 2006 6:43 PM
To: Struts Users Mailing List
Subject: RE: Displaying images from database.
Try the following:
/*** JSP
Try the following:
/*** JSP file /
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%
HashMap params = new HashMap();
params.put("ID", request.getParameter("ID"));
pageContext.setAttribute("params", params);
%>
/*** Action class */
import javax.servl
Gary Feidt wrote:
> Your example is using Struts 1.2.6. Maybe I can upgrade, but I don't
> think so right now. I guess I was thinking of it in the wrong way as
> you stated, but I sure did not think it would be difficult to display an
> image stored in a database on a web page.
>
It's not. It
You don't really need to upgrade to 1.2.6, all you need to do is take the
DownloadAction class (and the ResourceStreamInfo class IIRC) from 1.2.6
and use it. There's nothing that I recall that would make it not work in
previos versions of Struts.
I have an app that downloads images from a databas
At the risk of getting murdered again for too many comments I'll offer
this recipe
J.
How to read an image from a db and display in an html page
Goal: Display an image that is stored in a database blob in a .jsp page
Synopsis: The blob is read into a byte array that is stored in the
ActionForm.
Your example is using Struts 1.2.6. Maybe I can upgrade, but I don't
think so right now. I guess I was thinking of it in the wrong way as
you stated, but I sure did not think it would be difficult to display an
image stored in a database on a web page.
If anyone else has a work around that they
Gary Feidt wrote:
> Will the tag display a java.io.InputStream, or is there a
> better way?
>
Not that I know of, unless the tag API doc at
http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#img
is wrong.
You can, however, use an action or a servlet to deliver the image data.
I think you're thinking about this the wrong way round. Tags run on
the server to generate HTML content - so all the tag does
is render the html markup of - its then the browsers
job to download the image referenced in the "src" attribute.
So what you need is to specify a url in that src attribu
You'd have to write an Action which reads the image from the DB and
writes it onto the servlet's output stream. There was a thread just
yesterday which discussed how to do this. You can set your image URL
to that action and provide it with enough parameters to find your
image in the DB.
Hubert
18 matches
Mail list logo