• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

download report + struts 2

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not use the "stream" result type?

http://struts.apache.org/2.x/docs/stream-result.html
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it writes the result for you, and everything is set from the config. Less code == good.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic