It is a Java servlet allows you to quickly build and deploy surveys and polls on your web site. Servlet supports WAP/WML so you may use it for your mobile users too.
You can use your own HTML (WML) stuff for survey's design and deploy servlet only as a script lets you save/review results. Or you can generate survey with this servlet without any knowledge about HTML or WML.
How to use it:
a) copy votePackage.jar into your WEB-INF/lib directory.
b) define servlet in your web.xml file:
c) define a mapping for Vote servlet
For each your poll you must provide a configuration file describes how to save messages as well as various interface settings. You can use VoteServlet 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: http://your_host/servlet/VoteServlet
A. You are using your own design for survey.
Just set this servlet as an action for your form:
Configuration file is a text file, each line describes one parameter in the form of
param=value
Empty lines and any line starts with # or // are ignored. Current version supports the following list of parameters:
# log file. File for poll results
# This parameter is mandatory
log=your_file_is_here
# after vote page. This page will be displayed when user submits vote.
# By default current vote results will be outputted.
after=http://your_host/your_page.htm
# or for WAP:
after=/your_page.wml
# Use cookies for preventing second time vote.
# Default value is 0 (do not use cookies).
# Otherwise you may set time in seconds when new vote
# will be prohibited. E.g. (24 hours time):
cookies=86400
So, you have two forms for servlet usage:
Submit vote: http://host/servlet/VoteServlet?config=conf_file&act=vote
(or simply: http://host/servlet/VoteServlet?conf_file)
and
Show results: http://host/servlet/VoteServlet?config=conf_file&act=log
If you are using initial parameters than just skip config parameter:
Submit vote: http://host/servlet/VoteServlet?act=vote
(or simply: http://host/servlet/VoteServlet)
and
Show results: http://host/servlet/VoteServlet?act=log
B. You can generate survey with this servlet
Set some additional parameters in your config file and use
http://host/servlet/VoteServlet?config=conf_file&act=view
(or http://host/servlet/VoteServlet?act=view if configuration file
described as an initial parameter).
for creating you survey
Additional parameters for config file are:
# background color (by default is white - #FFFFFF)
bgcolor=#FFFFF
# foreground color (by default is black - #000000)
fgcolor=#000000
# font size. By default is current browser's font
size=2
# font face. By default is current browser's font
face=Verdana,Arial
# vote colors. Color for bar chart (by default is red #FF0000)
votecolor=#FF0000
# title (Default value is Coldbeans vote)
title=My Survey
# options (this is mandatory for generated surveys)
# List of options separated by commas.
options=My option1,My Option2,MyOption3
# Page orientation. Describes how to display options - in the one column
# (default value is 1) or in the one row (in case of column=0)
column=1
Log file format
It is a text file with comma separated values. Each line contains: IP address, date, option value
JSP integration
In JSP pages you may use special custom tags for viewing results of your polls. See Vote taglib for more details.
Note:
1. Configuration file can be saved anywhere on your server. E.g. if you are using VoteServlet?config line we assume this file is saved under the root (docBase) directory of your servletrunner. But you can of course always use the full path for setting config file location: VoteServlet?/home/users/my_file (or VoteServlet?c:\users\my_file)
2. Some WAP gateways do not support cookies.
3. For WAP/WML options will be always outputted in the one column.
4. Log file could be saved anywhere on your server. Just use the full path. E.g.: log=c:/mydata/votes/log1.txt
5. If after value starts with http than request will be redirected to that site. Otherwise servlet assumes a local resource and forwards request.
6. Evaluation version supports up to 20 votes.
For downloading: votePackage.jar
Sample of configuration file: voteconf
© Coldbeans Software Comments?
See also JSOS - the largest collection of servlets and filters.