Using JasperReports to Generate PDF and Reports in Web Applications

We just published a new tutorial today on how to use the JasperReports framework in a web application built using the Sun Java Studio Creator IDE. In this tutorial, you create a web application that displays and prints information from a travel database. The web application lets you view a trip report in either HTML format or PDF format.

Some interesting parts of this tutorial are that you use a managed bean instead of a servlet to generate the report, you add an entry to the build.xml file to compile the reports for you, and you reuse your dataprovider's rowset query for the report.


Check it out at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/reports.html.

Comments:

i need ireport tutorials.

Posted by sergen on January 03, 2007 at 07:51 PM PST #

Thanks for the suggestion. We have a backlog but will add it to our list.

Posted by diva#2 on January 04, 2007 at 12:56 AM PST #

Hi, Good tutorial! :-). With this, I easily got JasperReport working with JSC. However, I have one query: The first record is not shown. In the example, the first trip from Kona to Trenton is not shown. Why is this and what can I do to resolve this? Note: the resultset is returning all rows, however, in the PDF, the first row is missing. Thanks

Posted by Sallisha Kadir on January 06, 2007 at 09:38 PM PST #

Hello, thank you for reporting this. I will push out a fix as soon as possible. In the meantime, try adding
        try {
            data.beforeFirst();
        } catch (Exception e) {
            throw new FacesException(e);
        }
 
Just before the following code in the app bean
        // Fill the requested report with the specified data
        JRResultSetDataSource ds = new JRResultSetDataSource(data);
Another possible solution, which I have not tried, is to call tripDataProvider.refresh() before tripDataProvider.close() in the button action methods.

I am still trying to figure out why this is necessary.

Posted by diva#2 on January 07, 2007 at 04:59 AM PST #

Post a Comment:
Comments are closed for this entry.
About

divas

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today