This really belongs on the user list, but JSP's are perfectly happy to spit out
whatever you want:

<%@ page contentType="application/pdf" %>

They might not be the best choice for certain content, but they're capable of
doing a lot more than just text output.

Quoting Tom Drake <[EMAIL PROTECTED]>:

> Sorry, JSP's are only capable of producing text output. You'll need a
> servlet to produce PDF output. Also, if you're retrieving the PDF content
> from the database consider using the 'ResultSet.getBinaryStream(...)' and
> copy the resulting input stream to the response output stream, as opposed
> to
> materializing the entire PDF 'file' in memory and then writing it.
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 22, 2003 4:50 PM
> To: [EMAIL PROTECTED]
> Subject: 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.

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to