This Java servlet collects data from any html form and saves them in xml-format.
You must just set this servlet as an action parameter for your form. Servlet reads posted data and saves them in xml file.
How to use it:
a) copy surveyPackage.jar into your WEB-INF/lib directory.
b) define SurveyXMLServlet servlet in your web.xml file.
c) define a mapping:
In order to use this servlet you have to provide a configuration file. This file describes how to save data and what to do after that. There are two forms of usage:
a) pass configuration file as a parameter:
<form method="post" action="http://your_host/servlet/SurveyXMLServlet?xmlconfig.txt">
b) describe configuration file as an initial parameter for servlet (parameter name is config). So in your
web.xml file you may have some like this:
and use servlet in this form:
<form method="post" action="http://your_host/servlet/SurveyXMLServlet">
Servlet provides server side validation for posted data. All fields those names begins with * are mandatory.
By default servlet uses the following DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT records (record+)>
you can define your own DTD file in servlet's config.
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 file. This parameter is mandatory
You may customize after-saving and error redirection pages with data submitted in the request. When you describe after (or error) parameter in your configuration file you may use templates like $some_name. Servlet assumes that some_name is a parameter in posted request and $some_name will be replaced with encoded value of this parameter. So, in your config file you may have some like this:
1. You can save configuration file anywhere on your server.
Just use the proper path for setting servlet's parameter. Short path
(just a name of your file) means that your configuration file is saved under
servletrunner's root directory. But you can always use some like this:
2. XML file can be created anywhere on your server (just check out access rights).
3. If after or error value
starts with http than request will be redirected to that
site after data saving. Otherwise servlet assumes a local resource and forwards request.
See also JSOS - the largest collection of servlets and filters.
Also in JSOS: