• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

generating pdf from jsp

 
Swathi Ram
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all.....

I'm trying to figure out a way to generate a pdf file using struts 2. Does Struts facilitate this??
I came across some examples that used jasperreports........if anyone has info on this or any other suggestion or any sample code, please help.

Thankyou.
Swathi
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34655
365
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swathi,
Struts is just a framework. You need to plugin a library to generate the PDF like Jasper or iText (open source PDF generator)
 
Swathi Ram
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to implement the JasperReport to generate a pdf.

I created the template and action class and put the following action mapping in my struts.xml

<result-types>
<result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult" />
</result-types>

<action name="myJasperTest" class="com.nursefinders.JasperAction">
<result name="success" type="jasper">
<param name="location">/jasper/jasper_output.jasper</param>
<param name="dataSource">myList</param>
<param name="format">PDF</param>
</result>
</action>

But I don't have jasperreports.JasperReportsResult in my org.apache.struts2.views. How do I get that???
Do I need to have any plugin for that? If so which one?

Thanks
Swathi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic