Jump to content
We've recently updated our Privacy Statement, available here ×

Want a simple web app integration solution? Read on.


darth_fader

Recommended Posts

I've developed a simple web app integration solution that will remove the headaches associated with deployment and integration of jasper reports into a web application.  You will not have to write a single line of java code. Guaranteed.  To integrate this solution, all you have to do is perform the following three step process:

1) register report.spring.xml (spring configuration file) and a custom jasperReports servlet in web.xml

2) create a "reports" folder in your META-INF directory, and put all of your reports and report resources in that directory (can be jrxml, .jasper, folders, images, etc.)

3) format links in your views that point to the custom jasperReports servlet and contain the required request parameters.

ex: /yourAppRoot/jasper.report?uniqueId=1&reportName=general_case_info&reportType=application/pdf 

where the request parameters are as follows:

  • uniqueId: the jasper report parameter used in your sql query to pull data for a given unique identifier
  • reportName: the name of the .jrxml file or .jasper file you are referencing
  • reportType: the type of report you would like to generate

In the above example, uniqueId is 1, reportName is general_case_info, and reportType is pdf.  You can optionally also specify the name of the file name that jasper generates, so you have a quality unique file name that can easily be downloaded/saved.  

And that's it.  Simple as that.  

Other benefits include: 

  • a resource locator, eliminates the need to specify paths to images, subReports, etc in a .jrxml file (all you do is specify the resource name, and if it exists, it will be found)
  • on the fly report compilation: no need to pre-compile the reports, if you reference a .jrxml file, it will be compiled on request
  • separation of duties: allows developers to focus on development, allows report designers to focus on design, neither role need be bothered with jasper reports integration

If you're interested in this solution, email me at psycodekIT@gmail.com or visit psycodek.com and click the "Contact Us" link.  I'll provide you with additional details and a link to a demo application.

 

 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

FYI: This solution, packaged as a very light weight jar, is compatible with Spring 2.x+ and Jasper 2.x+. As far as spring beans go, there are a grand total of 5 singleton spring beans (working on reducing that number), so the footprint is small. I'm also working on a pure JEE solution, for those that don't currently have or want to introduce Spring dependencies.
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...