Using the JasperReports Framework in Visual Web Applications to Generate PDF and HTML Reports
By divas on Nov 21, 2006
We just posted the http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/reports.html tutorial to the Sun Java Studio Creator Tutorials web site. This tutorial works for the Visual Web Pack with the following changes.
- The source is in src/java instead of just src.
- Creating a JasperReports Library
- Step 3: the library type is "Class Libraries"
- For the Sun Java System Application Server, you must also add the commons-beanutils, commons-collections, and commons-logging jars to the library.
- Setting Up the JRXML Editing Environment
- Step 2: Click Advanced Options, then expand Options > IDE Configuration > System > Object Types to get to XML Objects.
- Creating the Project and Authorizing Access to the JasperReport Classes
- Create a Visual Web Application and use the BluePrints structure.
- You do not need to do steps 5 through 10 for the Sun Java System Application Server.
- Creating the Database Query
- Also clear the LASTEDUPDATED column from each table.
- Setting Up the Report Resources
- To add the second source directory for the JRXML files, switch to the Files window.
- Right-click the project node, and select New > Folder.
- Set the folder name to
- Set the parent folder to
src(that is, the "src" directory inside the project) so that this node will be parallel to
- Click Finish. Note that the directory is only visible on the files view.
- Right-click the project name, and select Properties.
- Click Add Folder, navigate to the
src/reportsnode, and click Open.
- Change the Label from the default (src/newfolder) to something
meaningful, such as
JasperReports Definitionsand click OK.
- Switch back to the Projects window, and you will see this new node, with a <default package> node underneath it.
- Put the JRXML files under the <default package>
node (that is, into directory