Struts 2, Jasperreport, iReport and Maven

Step 1: Adding POM Dependency


Step 2: Design the “jrxml” file using iReport. You can also manually design this “jrxml”

Step 3: Struts.xml




In Struts.xml result “type” must be jasper. “location” means where the compiled jrxmlfile will be present to
generate the report param “format” is the format in which the user is trying to export it can be PDF,XLS,CSV etc.
“datasource” as “objectReportList” the object list fed to jasper report from which the data is populated this
is present inside the action class. For example of you are trying to export “Person” details the
datasource will be “personList” this is fetched from database in Action class.

Step 4: Compiling jrxml file to jasper file
the folowing code is to be written inside your Action class


After successful export you can remove the compilation code and just place the jasper file in the location
to avoid compilation of jrxml file to jasper everytime when you are exporting,br/.
specified in struts.xml


Tags: , , , ,

One Response to “Struts 2, Jasperreport, iReport and Maven”

  1. weblink Says:

    Thanks to my father who told me on the topic of this web site,
    this blog is actually remarkable.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s