org.dbforms.servlets
Class CSVReportServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.dbforms.servlets.base.AbstractServletBase
org.dbforms.servlets.reports.AbstractReportServlet
org.dbforms.servlets.reports.AbstractLineReportServlet
org.dbforms.servlets.CSVReportServlet
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class CSVReportServlet
- extends AbstractLineReportServlet
This servlet generates a comma separated values file (CSV). Data is read from
the current dbForm, a Collection or a ResultSetVector The template file is in
the reports directory with a .cr extension it consists of two lines of text,
the first is a list of stirngs to use as header the second a list of comma
separated field names. both lines must have the same number of elements.
Normally the output file will use the first row as the headers. But if no
header line is provided, then no headers are output and every row is data.
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>
web.xml optional parameters reportdirs list of directories to search for
report file reportMimeType mime type to send to browser Parameters
filename=xyz.csv name the output file 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" />
- Author:
- Neal Katz
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CSVReportServlet
public CSVReportServlet()
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
writeData
protected void writeData(Object[] data)
throws Exception
- Specified by:
writeData
in class AbstractLineReportServlet
- Throws:
Exception
Copyright © 2002-2006 DbForms. All Rights Reserved.