Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Dynamic Jasper Report on jsp  RSS feed

NazneenAliza Shaikh
Posts: 10
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!