File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes download report + struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "download report + struts 2" Watch "download report + struts 2" New topic
Author

download report + struts 2

aneesh vijayakumar
Greenhorn

Joined: Jul 01, 2008
Posts: 13
Hello,

I am using struts 2 in my application. I have to do report download. I am doing the report build in one action and then moving to another page. I need the download option to come when i move to the page after report build.

For the reporting stuff i am using jasper reporting.
I gave like

response.sendRedirect("../../../images/upload/reportDestDir/1GenericReport.pdf");

in the downloadDetailsPage.

In struts i gave like

<action name="download" class="com.trivand.apps.autos.action.***Action" method="downloadReport">
<result name="success">/pages/common/public/downloadDetailsPage.jsp</result>
</action>

But i need to do it like after the action is performed it should go to the downloadDetailsPage and show the download or openwith option..

Please help me out...

Thanks in advance

Aneesh
aneesh vijayakumar
Greenhorn

Joined: Jul 01, 2008
Posts: 13
Hello,

I have done the download

I did like



Now the download option is working..But there is some error in console like

java.lang.IllegalStateException: getOutputStream() has already been called for this response

It is actually not affecting the result. When i googled it, its given like this is not a critical error.

If anyone has a resolution to it please post here...

Thanks
Anees
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not use the "stream" result type?

http://struts.apache.org/2.x/docs/stream-result.html
aneesh vijayakumar
Greenhorn

Joined: Jul 01, 2008
Posts: 13
Thanks David for the suggestion

But i am using tiles in my application.

So I gave like

<action name="download" class="com.trivand.apps.autos.action.***Action" method="downloadReport">
<result name="success" type="tiles">***.****.downloadAuto</result>
</action>

Is there any specific advantage of using stream result in downloading?

Thanks
Aneesh
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes, it writes the result for you, and everything is set from the config. Less code == good.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: download report + struts 2
 
Similar Threads
Struts2: which result type to use
Jsp is not displaying in Struts2
problem in combining <jsp:include> and struts 2.2.1
Struts action not returning page on first click of button
returning a resultset