Java Servlet lets you quickly publishing so called commas separated values files. CSV files are text files where rows contain data separated by commas (separator is actually configurable). It is a standard and portable way to present source data in many systems. And this component simply lets you quickly display them on the web. How to use it:
1) copy csvPackage.jar into WEB-INF/lib directory
2) describe CSVPublishing servlet in your web.xml file:
3) describe a mapping for this servlet
You must provide a configuration file describes how to display your data as well as the various interface settings. You can use CSVPublishing in two forms:
a) pass configuration file as a parameter. E.g.:
b) define your configuration file as an initial parameter for servlet
(parameter name is config):
and use servlet in this form:
Configuration file is a text file, each line describes one parameter in the form of
Empty lines and any line starts with # or // are ignored. Current version supports the following list of parameters:
# data - describes your data file. This parameter is mandatory
# title. Describes a title for your page. Default value is empty (no title)
# header. You can set here some file contains any html-code.
# footer. You can set here some file contains any html-code. This code
# body. Describes a CSS style for the body. Default value is background-color:#FFFFFF
# firstRow. Describes a CSS style for the first row. Default value is background-color:#FFFFFF
# oddRow. Describes a CSS style for odd rows. Default value is background-color:#FFFFFF
# evenRow. Describes a CSS style for even rows. Default value is background-color:#FFFFF0
# page. Describes a size for the pages (in rows). Default value is 50
# width. Describes a width for your data table. E.g.:
# columns. Describes a commas separated list of displayed columns starting from 1.
# separator. Describes a separator. Default value is ,.
Note: configuration file can be saved anywhere on your server. E.g. if you are using CSVPublishing?config command we assume this file is saved under the root directory (docBase) of your container. But you can of course always use full name for setting config file location: CSVPublishing?/home/users/my_file (or CSVPublishing?c:\users\my_file)
See also JSOS - the largest collection of servlets and filters.
Also in JSOS: