How to build a Custom Parameter Jsp Page for Birt Report Using Birt Viewer tags

Problem – While creating Birt reports, a default parameter page is shown. This page consists of all the parameters required to generate a report.

User does now have full control to change the functionality and look and feel of this page. To have full customization control of this page, there should a customized jsp page so that user can do any type of validation, conditional show/hide of parameters and much more.

1. Need to create a customized page.

2. All the parameter values should be sent to report to generate reports.

3. Default parameter page should not be shown.

Solution

We can create custom parameter page using Birt Viewer Tag Library. Using this tag library we will use parameterPage tag Attributes to make a jsp as parameter page.

Steps to Create a report having customized parameter page-

1. Create a jsp with all the parameter inputs using parameterPage tag of Birt Viewer Tag Library.

Example of Jsp is shown below-

<%@ page language=”java” contentType=”text/html; charset=ISO-8859-1″
pageEncoding=”ISO-8859-1″%>
<%@ taglib uri=”/birt.tld” prefix=”birt” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
</head>
<body>
<birt:parameterPage id=”birtParmPage” reportDesign=”SampleReport.rptdesign”
name=”Sample report form”
pattern=”frameset”
height=”600″
width=”800″
title=”Sample Report”
isCustom=”true”
showTitle=”true”
showToolBar=”true”
showNavigationBar=”true”
baseURL=”/Birt”

<!– The baseURL is used to determine the location of the Viewer application. If the tags are used in the same context as the BIRT viewer this attribute is not required. If the tag library is used in a separate context but in the same application server, this setting may contain a value such as baseURL=/Birt
 >
Start Date parameter
——————–
<input type=”Text” name=”Start Date”>
<br><br>
Parameter 1
——————
<input type=”Text” name=”parameter1″>
<br><br>
Parameter 2
——————–
<input type=”Text” name=”parameter2″>
<br><br>

<input type=”Submit” value=”Run Report”>
</birt:parameterPage>
</body>
</html>

2.  Create Birt report with same number of parameters as defined in the jsp.

Note– Name of parameters in jsp and report should be exactly same.

3. Place both these files in the birt viewer root directory.

4.  In explorer, point to jsp.

5. Customized page would be shown.

6. Fill all the details and report would be generated according to the parameter values.

7. If some required field of report is left blank in the customized jsp then birt default parameter page would be shown.

3 Responses to How to build a Custom Parameter Jsp Page for Birt Report Using Birt Viewer tags

  1. Shaan says:

    I am using the same code but an error “The viewing session is not available or has expired.” is coming when birt report page opens. Kindly let me know if i have to change the Parameter properties or anything else in my .rptdesign file.
    Kindly help me out ASAP.

    • which version of Birt and browser, u r using. Please paste some short logs also.

      • Shaan says:

        I m using birt 3.7.0 with IE 6. the logs are as:

        13:14:10,578 ERROR [STDERR] org.eclipse.birt.report.exception.ViewerException: The viewing session is not available or has expired.
        13:14:10,578 ERROR [STDERR] at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:239)
        13:14:10,578 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        13:14:10,578 ERROR [STDERR] at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        13:14:10,578 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        13:14:10,578 ERROR [STDERR] at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        13:14:10,578 ERROR [STDERR] at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        13:14:10,578 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        13:14:10,578 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
        13:14:10,578 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        13:14:10,578 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        13:14:10,578 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        13:14:10,578 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        13:14:10,578 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        13:14:10,578 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        13:14:10,593 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)

Leave a reply to Shaan Cancel reply