You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by le...@bankone.com on 2003/07/23 01:50:02 UTC

Streaming PDF file with the bean:write tag -- please help

I would like to be able to display/stream the PDF file in the browser and
use the <bean:write> tag in the JSP to acomplish that.
Say I have a form bean that has a byte array field, and I want the jsp to
specify the contentType as "application/pdf" and just have the bean:write
tag, such as:

<bean:write name="mybean" property="pdfcontent"/>

Is this possible to achieve? Are there any hacks/tricks to make it work in
a JSP when the form bean has the binary content field?

When I do it with with the byte array attribute, it just displays the
address of the array in memory (possibly calls toString()). If I make the
field of type String and convert the byte array to String in the
controller as follows: str = new String(byteArray),  it does not get
converted correctly and the browser hangs.

I know the best way to do it is to have a servlet. But I need to do it in
a JSP because of certain limitations of my application. Please help.

Thanks.



This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.


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


Re: Streaming PDF file with the bean:write tag -- please help

Posted by Kent Sølvsten Rasmussen <ke...@aarhusmail.dk>.
This is a Struts User question, so please post it in the Users List.

I just wonder why you want to use a jsp for this. Normally I would use a servlet for binary content.


leonard_reinstein@bankone.com wrote:
> 
> I would like to be able to display/stream the PDF file in
> the browser and
> use the <bean:write> tag in the JSP to acomplish that.
> Say I have a form bean that has a byte array field, and I
> want the jsp to
> specify the contentType as "application/pdf" and just have
> the bean:write
> tag, such as:
> 
> <bean:write name="mybean" property="pdfcontent"/>
> 
> Is this possible to achieve? Are there any hacks/tricks to
> make it work in
> a JSP when the form bean has the binary content field?
> 
> When I do it with with the byte array attribute, it just
> displays the
> address of the array in memory (possibly calls toString()).
> If I make the
> field of type String and convert the byte array to String in
> the
> controller as follows: str = new String(byteArray),  it does
> not get
> converted correctly and the browser hangs.
> 
> I know the best way to do it is to have a servlet. But I
> need to do it in
> a JSP because of certain limitations of my application.
> Please help.
> 
> Thanks.
> 
> 
> 
> This transmission may contain information that is
> privileged, confidential and/or exempt from disclosure under
> applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein
> (including any reliance thereon) is STRICTLY PROHIBITED. If
> you received this transmission in error, please immediately
> contact the sender and destroy the material in its entirety,
> whether in electronic or hard copy format. Thank you.
> 
> 
> ------------------------------------------------------------
> ---------
> To unsubscribe, e-mail:
> struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-dev-help@jakarta.apache.org
> 


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