I'm working on a Struts 2 web application (using Struts version 2.1.2)
that needs to take an XML file and create a PDF report.  I've previously
used the Struts 2 JasperReports plugin to generate a PDF but my data
source was an ArrayList.  For example see:

 

http://www.brucephillips.name/blog/index.cfm/2008/7/12/Using-The-JasperR
eports-Struts2-Plugin-A-Main-Report-And-A-Subreport 

 

I've not been able to find a good example of using the Struts 2
JasperReport plugin with a data source of XML.  If anyone knows of a
good example please reply.

 

Here is where I think I'm stuck.  In my struts.xml file I have this
action defined:

 

            <action name="myJasperTest" class="action.JasperAction">

 

                  <result name="success" type="jasper">

                        <param
name="location">/jasper/PeopleXMLReport.jasper</param>

                        <param name="dataSource">Xml</param>

                        <param name="format">PDF</param>

                  </result>

 

                  <result name="error" type="jasper">/Error.jsp</result>

 

            </action>

 

The param name="dataSource" with a value of Xml does call the getXml
method in my action.JasperAction class.  This method returns an object
of type org.w3c.dom.Document.  But in my PDF I just get null values.  So
I'm not sure what my getXML method should be returning.

 

Any help would be greatly appreciated.

 

Bruce

Reply via email to