• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 2.2 jasper report filename issue

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts2-jasperreports-plugin-2.2.3.1 and I'm having a problem getting a correct filename to display when clicking "save as". The default filename that is displayed when the dialog first appears is the name of the action. I have the following in my struts.xml file:

<global-results>
<result name="pdf" type="jasper">
<param name="location">/reports/${jasperRpt}</param>
<param name="dataSource">jasperRptData</param>
<param name="format">PDF</param>
<param name="reportParameters">jasperRptParams</param>
<param name="documentName">jasperRptFileName</param>
</result>
<result name="xls" type="jasper">
<param name="location">/reports/${jasperRpt}</param>
<param name="dataSource">jasperRptData</param>
<param name="format">XLS</param>
<param name="documentName">jasperRptFileName</param>
<param name="reportParameters">jasperRptParams</param>
</result>
</global-results>

Following the API javadoc, when the output response stream is written, Content-disposition was set with "inline;filename=jasperRptFilename.pdf", which should result in jasperRptFilename.pdf appearing as the default name when the save dialog appears. Rather, the name of the action is shown. I've included an attachment, which shows the name of the action, generateStandardReport.pdf, as the default display name.

Also, "Struts Problem Report" appears as the tab title for the report. I turned the log4j information level to DEBUG, and didn't see one Exception in the log file, so I don't know where that is coming from, and if it's involved in the issue at hand. I've also included an attachment showing that as well.

Any assistance will be GREATLY appreciated. By the way, I'm using jasperreports-4.1.3, along with it's associated dependent jars.
report_data_display.JPG
[Thumbnail for report_data_display.JPG]
report_save_dialog.JPG
[Thumbnail for report_save_dialog.JPG]
 
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a complete working example on Struts2 Jasper Reports.

http://www.onlinexamples.com/showfullexample.action?idexamples=20&title=Jasper%20Report%20Example
 
V. Oliver Smith
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nitin,

thanks so much. The key wasn't changing the code to match your example. it was to add

<param name="contentDisposition">attachment</param>

Now everything is "copasetic" (smile)

Thanks again
 
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic