You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Janek Ziniewicz <ja...@gmail.com> on 2005/05/31 11:46:36 UTC

Displaying files from database on a webpage

Hi,
  what I want to do is display in a webpage file which is stored in database.
My struts app should recognize its mime type and according to this
perform suitable action (eg if it is *pdf run acrobat, if *html just
display it,  etc). I know how to put and get this data from dbase and
how to recognize its mime type but this is not enough to do the task.

Code below causes java.lang.IllegalStateException. Although in some
cases I can see attachment on screen. How can I make work?

ServletOutputStream sout=response.getOutputStream();
sout.write(blob);

-- 
Pozdrawiam, Janek Ziniewicz
gg: 902858
irc.freenode.net: #gore, #dub

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


Displaying files from database on a webpage

Posted by Janek Ziniewicz <ja...@gmail.com>.
Hi,
  what I want to do is display in a webpage file which is stored in database.
My struts app should recognize its mime type and according to this
perform suitable action (eg if it is *pdf run acrobat, if *html just
display it,  etc). I know how to put and get this data from dbase and
how to recognize its mime type but this is not enough to do the task.

Code below causes java.lang.IllegalStateException. Although in some
cases I can see attachment on screen. How can I make work?

ServletOutputStream sout=response.getOutputStream();
sout.write(blob);

--
Pozdrawiam, Janek Ziniewicz
gg: 902858
irc.freenode.net: #gore, #dub

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


Re: Displaying files from database on a webpage

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Have a look at the sample app I wrote to demonstrate the DownloadAction:

http://wiki.apache.org/struts/StrutsFileDownload

There is some code in there for doing exactly what your trying to do.  You
might find an answer there.

I'm not sure off-hand why your getting that exception unfortunately.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 31, 2005 5:46 am, Janek Ziniewicz said:
> Hi,
>   what I want to do is display in a webpage file which is stored in
> database.
> My struts app should recognize its mime type and according to this
> perform suitable action (eg if it is *pdf run acrobat, if *html just
> display it,  etc). I know how to put and get this data from dbase and
> how to recognize its mime type but this is not enough to do the task.
>
> Code below causes java.lang.IllegalStateException. Although in some
> cases I can see attachment on screen. How can I make work?
>
> ServletOutputStream sout=response.getOutputStream();
> sout.write(blob);
>
> --
> Pozdrawiam, Janek Ziniewicz
> gg: 902858
> irc.freenode.net: #gore, #dub
>
> ---------------------------------------------------------------------
> 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