i-net Clear Reports

com.inet.report
Class ReportServletJSP

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.inet.report.ReportServlet
              extended by com.inet.report.ReportServletJSP
All Implemented Interfaces:
PropertiesChecker, java.io.Serializable, javax.servlet.FilterChain, javax.servlet.jsp.HttpJspPage, javax.servlet.jsp.JspPage, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class ReportServletJSP
extends ReportServlet
implements javax.servlet.jsp.HttpJspPage

This class implements the communication between the client that created the requested report and the engine. The ReportServletJSP is meant to be used as a parent for JSP pages which want to make use of i-net Clear Reports. It implements a method that reads parameters from the request and stores them in the variable props. The descending JSP servlet can read these parameters and create a HTML page.
Here's how a JSP is used to generate a report:

  1. A client requests the following getLine: http://localhost:8080?report=file:c:/report1.rpt&prompt0=1&SF=true&hasgrouptree=false
  2. A properties object is created with contains the pairs (report . http://localhost:8080?report=file:c:/report1.rpt&prompt0=1&SF=true), (prompt0 . 1), (SF . true) (hasgrouptree . false).
  3. The code below marked with "STEP 1" is returned to the client. You can use the properties object to modify the HTML code.
  4. The viewer starts in the client's HTML page and passes the getLine above back to the report servlet.
  5. The report servlet reads the getLine passed to it from the report viewer and converts it into key/value pairs and stores them into a newly allocated properties object. The object contains the entries: (report . http://localhost:8080?report=file:c:/report1.rpt&prompt0=1&SF=true), (prompt0 . 1), (SF . true).
  6. checkProperties is run (see code below marked with STEP 2).
  7. the report template is examined, an engine object is created.
  8. checkProperties with an engine parameter is run (see code below marked with STEP 3).
  9. the report is executed, the report servlet sends back the binary data to the report viewer running in the client's HTML page.

See Also:
Serialized Form

Constructor Summary
ReportServletJSP()
          Initialize a ReportServletJSP object.
 
Method Summary
 void doWriteHtmlPage(java.util.Properties props, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          This method sets up a properties object for you and calls _jspService(req, res) which is the HTML page you have written translated into java code.
 void init(javax.servlet.ServletConfig config)
          Initialize the servlet and logs the initialization.
 void jspDestroy()
          Method will be called when the JSP container attempts to destroy the JSP servlet.
 void jspInit()
          Method will be called when the JSP container initialize the JSP servlet.
 
Methods inherited from class com.inet.report.ReportServlet
afterPropertiesStoredHook, checkHtmlPageProperties, checkProperties, checkProperties, checkProperties, checkProperties, destroy, doExecRequest, doFilter, service, setPropertiesChecker
 

Constructor Detail

ReportServletJSP

public ReportServletJSP()
Initialize a ReportServletJSP object.

See Also:
ReportServlet.ReportServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initialize the servlet and logs the initialization.

Overrides:
init in class ReportServlet
Parameters:
config - servlet configuration information
Throws:
javax.servlet.ServletException - if an exception occurs that interrupts the servlet's normal operation

jspInit

public void jspInit()
Method will be called when the JSP container initialize the JSP servlet.
If you override this method, make sure to call `this.init(getServletConfig()'.


jspDestroy

public void jspDestroy()
Method will be called when the JSP container attempts to destroy the JSP servlet.
If you override this method, make sure to call `super.jspDestroy()'.


doWriteHtmlPage

public void doWriteHtmlPage(java.util.Properties props,
                            javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse res)
                     throws java.io.IOException,
                            javax.servlet.ServletException
This method sets up a properties object for you and calls _jspService(req, res) which is the HTML page you have written translated into java code. For example you might have given the following HTML code:
 <HTML>
 <HEAD><TITLE>My Report Viewer</TITLE></HEAD>
 <BODY bgcolor="C6C6C6">
 <applet code="com.inet.viewer.ViewerApplet"
 codebase=<%=props.getProperty("http_server_port") + "/client" %> id=ReportViewer width=100% height=100%>
 <param name=ReportName value=<%=props.getProperty("report") %> >
 <param name=HasGroupTree value=false>
 <param name=HasExportButton value=true>
 <param name=HasRefreshButton value=true>
 <param name=HasPrintButton value=true>
 <param name=HasLoggingEnabled value=true>
 <param name=HasTextSearchControls value=true>
 <param name=Archive value=<%=props.getProperty("http_server_port") +
 "/core/ReportViewer.jar"%> >
 </applet>
 </BODY>
 </HTML>
 
Note that within your JSP all checkProperties callbacks are available. For example:
 public void checkProperties (Engine engine, Properties prop, Object serviceRequest) {
     // examine parameter fields
     Fields df = engine.getFields();
     for(int i=0; i<df.getPromptVarFieldsCount(); i++) {
         PromptField f = (PromptField)df.getPromptVarField(i);
         System.out.println("PromptField# " + i + " : " +f.getName() + " " + f.getPromptValue());
     }
     // examine formula fields
     for(int i=0; i<df.getFormulaFieldsCount(); i++) {
         FormulaField f = (FormulaField) df.getFormulaField(i);
         System.out.println("FormulaField# " + i + " : " +f.getName() + " " + f.getFormula());
     }
 }

Overrides:
doWriteHtmlPage in class ReportServlet
Parameters:
props - Report properties to use when creating the HTML page
req - HttpServletRequest to use for the call to _jspService
res - HttpServletResponse to use for the call to _jspService
Throws:
java.io.IOException - if an exception occurs that interrupts the servlet's normal operation
javax.servlet.ServletException - if there is a problem calling HttpJspPage._jspService(HttpServletRequest, HttpServletResponse)
See Also:
HttpJspPage._jspService(HttpServletRequest, HttpServletResponse)

i-net Clear Reports

Copyright © 1999-2015 by i-net software GmbH