I am new to struts, and have just recently began porting our current web
application over to the struts framework.  A piece of our application
involves creating a pdf file and displaying it to the user.  Currently,
in the old framework, we set the ContextType of the response, and write
the byte content to the response's oputputstream, which will render the
pdf document in the browser.  I know I have direct access to the
response under Struts, but I wanted to see if there was a better
(cleaner) implementation within the struts framework that I may utilize.

Here's a snippet of what I'm doing:
---
response.setContentLength(doc.getContent().length);
response.setContentType(doc.getMimeType().toString());
response.getOutputStream().write(doc.getContent());
return new ActionForward();
---

I've noticed that I get a NullPointer exception after the return
statement on "some" requests.  I'm really unsure of why this is
happening as well.

Stack trace:
java.lang.NullPointerException at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestPr
ocessor.java:437) at
org.apache.struts.action.RequestProcessor.processActionForward(RequestPr
ocessor.java:401) at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279) at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

_________________
Jeremy Nix
Senior Application Developer
Southwest Financial Ltd.
[EMAIL PROTECTED]
(513) 621-6699 ext 1158

Reply via email to