File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Dynamic Jasper Report on jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Dynamic Jasper Report on jsp

NazneenAliza Shaikh

Joined: Jan 17, 2008
Posts: 10
Hello experts
I am working on jasper reports to generaete reports and also i have downloaded ireports latest version for working with jasper reports and creating reports .. its all working fine ... but now my requirement currently is something different

1. User will have a page where he would input the parameters like From Date - To Date and will select one another parameter

2. Depending on the parameter the search would be executed on the db and all the records matching the same criterial are required to be shown would be saved into the array list or what ever..

3. Now a report shall be generated for the same.. means a ".html" will be generated and given to the same jsp..

4.Only one jsp is responsible for taking the parameters and displaying the Reports...

5.I am perfectly generating the jasper reports depending upon the parameters from jsp(user)...but the problem is how to display that dynamically...(Using Iframe i am getting report but that is static not dynamic)...
Pliz help me out
give me code
Pavel Cherkashin
Ranch Hand

Joined: Mar 04, 2005
Posts: 47
divide your jsp on two independent parts, depending form parameter.

For example introduce parameter "showReport" = pass it by POST or GET. For instance if your one *.jsp page is report.jsp - to see form, use http://.../report.jsp?showReport=false, to see the result - use http://.../report.jsp?showReport=true.

Then this parameter can be considered to separate form rendering from results rendering. Use JSTL tags or easy scriplets to control the flow of jsp execution.

Use redirect or forward directive to output result from jasper.

The described solution does not imply any iframes. With frames - it is easier. Create two jsp pages first (one for form and one for result). show them in separate iframes of one html document. Use javascript to build url and point this url to access the result page, refresh it if there is a signal form form.

Pavel Cherkashin - <br />SCJP, SCWCD, SCDJWS, SCBCD, SCEA, ...<br />
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Dynamic Jasper Report on jsp
It's not a secret anymore!