org.dbforms.servlets
Class ExcelReportServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.dbforms.servlets.base.AbstractServletBase
              extended by org.dbforms.servlets.reports.AbstractReportServlet
                  extended by org.dbforms.servlets.reports.AbstractLineReportServlet
                      extended by org.dbforms.servlets.ExcelReportServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class ExcelReportServlet
extends AbstractLineReportServlet

This servlet generates a Microsoft Excel xls file using POI. Data is read from the current dbForm, a Collection or a ResultSetVector The template file is in the reports directory with a .xr extension it consists of one line of text, which is list of comma separated field names usage: with a simple goto button: <db:gotoButton destTable="web_parts" destination=" /reports/Artikel"/> or for one record: <db:gotoButton destTable="web_parts" keyToDestPos="currentRow" destination="/reports/Artikel" /> Servlet mapping must be set to handle all /reports by this servlet!!! <servlet/> <servlet-name/>startreport</servlet-name/> <display-name/>startreport</display-name/> <servlet-class/>org.dbforms.StartReportServlet</servlet-class/> </servlet> <servlet-mapping/> <servlet-name/>startreport</servlet-name/> <url-pattern/>/reports/</url-pattern/> </servlet-mapping> Parameters filename=xyz.xls name the output file sheetname=first_page name the worksheet Support for grabbing data from a Collection or an existing ResultSetVector set session variable "jasper.input" to use a Collection object set session variable "jasper.rsv" to use a ResultSetVector object ex <c:set var="jasper.rsv" value="${rsv_xxxxx}" scope="session" /> Note: Setting column headings does not work.

Author:
Neal Katz
See Also:
Serialized Form

Constructor Summary
ExcelReportServlet()
           
 
Method Summary
protected  void closeStream(OutputStream out)
           
protected  String getFileExtension()
           
protected  String getMimeType()
           
protected  void openStream(OutputStream out)
           
protected  void process(HttpServletRequest request, HttpServletResponse response)
          generates a report from request.
protected  void writeData(Object[] data)
           
protected  void writeHeader(String[] header)
           
 
Methods inherited from class org.dbforms.servlets.reports.AbstractLineReportServlet
getReportFileExtension, init, processReport
 
Methods inherited from class org.dbforms.servlets.reports.AbstractReportServlet
compileReport, handleException
 
Methods inherited from class org.dbforms.servlets.base.AbstractServletBase
doGet, doPost, sendErrorMessage
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcelReportServlet

public ExcelReportServlet()
Method Detail

getMimeType

protected String getMimeType()
Specified by:
getMimeType in class AbstractLineReportServlet

getFileExtension

protected String getFileExtension()
Specified by:
getFileExtension in class AbstractLineReportServlet

openStream

protected void openStream(OutputStream out)
                   throws Exception
Specified by:
openStream in class AbstractLineReportServlet
Throws:
Exception

closeStream

protected void closeStream(OutputStream out)
                    throws Exception
Specified by:
closeStream in class AbstractLineReportServlet
Throws:
Exception

writeHeader

protected void writeHeader(String[] header)
                    throws Exception
Overrides:
writeHeader in class AbstractLineReportServlet
Throws:
Exception

writeData

protected void writeData(Object[] data)
                  throws Exception
Specified by:
writeData in class AbstractLineReportServlet
Throws:
Exception

process

protected void process(HttpServletRequest request,
                       HttpServletResponse response)
Description copied from class: AbstractReportServlet
generates a report from request. Tries to get data from DbForms.

Overrides:
process in class AbstractReportServlet
Parameters:
request - HTTPServletRequest
response - HTTPServletResponse


Copyright © 2002-2006 DbForms. All Rights Reserved.