ToDo servlet 1.7

It is a Java servlet implements a collection of "to do" notes. So you may use this component when you need to provide a "to do" service in your web office. Servlet supports WAP/WML, so your mobile users will be connected too.

Servlet supports file based persistence - your data will be saved in the flat file (files) or database based persistence (through JDBC). See below how to define this option.

How to use it:

a) copy todoPackage.jar into your WEB-INF/lib directory.

b) define ToDoServlet in your web.xml file:

    <servlet>
     <servlet-name>ToDoServlet</servlet-name>
     <servlet-class>com.jsos.todo.ToDoServlet</servlet-class>
    </servlet>

c) define a mapping:

    <servlet-mapping>
     <servlet-name>ToDoServlet</servlet-name>
     <url-pattern>/servlet/ToDoServlet</url-pattern>
    </servlet-mapping>

the usage is:

    http://your_host/servlet/toDoServlet

For each your collection you must provide a configuration file describes how to save messages as well as various interface settings. You can use ToDoServlet in two forms.

a) pass configuration file as a parameter. E.g.:

http://your_host/servlet/ToSoServlet?config_file

b) define your configuration file as an initial parameter for servlet (parameter name is config):

    <servlet>
     <servlet-name>toDoServlet</servlet-name>
     <servlet-class>com.jsos.todo.ToDoServlet</servlet-class>
     <init-param>
      <param-name>config</param-name>
      <param-value>path_to_your_configuration_file</param-value>
     </init-param>
    </servlet>

and use servlet in this form: http://your_host/servlet/ToDoServlet

Configuration file is a text file, each line describes one parameter in the form of

    parameter=value

Empty lines and any line starts with # or // are ignored. Current version supports the following list of parameters:

# data persistence. You can use file based persistence or save
# your data in the any database supports JDBC.
# So you must either set the base directory for file based persistence
# or describe a JDBC connection to your database.
#
# File based persistence
#
# base directory - no default settings. This parameter must be defined
# in case of file based persistence.
# Base directory is some existing directory on your server.
base=path_to_your_directory

# JDBC settings. You must set this in case of db-based persistence
# Options are: (JDBC driver, database URL) pair or JNDI datasource
#
# JDBC driver
driver=your_jdbc_driver
# db URL
url=your_db_url

# JNDI name (instead of the above mentioned pair)
jndiname=your_data_source

# Optional parameter: user name for JDBC connection. You can omit this parameter.
user=db_user
# Optional parameter: password for JDBC connection. You can omit this parameter.
password=db_user's_password
# name of the first table
table1=your_db_table
# name of the second table
table2=your_db_table
# See below DDL description for data tables

# Interface

# background color (default value is #FFFFFF)
bgcolor=#FFFFF

# foreground color (default value is #000000)
fgcolor=#000000

# table's title background (Default value is #CCCCFF)
bgtitle=#CFAFB7

# you can set also different backgrounds for odd and even
# rows in the main table.

# odd rows. Default value is #FFFFE0
oddrowcolor=#FFFFE0

# even rows. Default value is #ADD8E6
evenrowcolor=#ADD8E6

# allows modification (1 or 0. Default value is 1 - you can add, edit, delete notes)
modify=1

# page size. Default value is 20
page=30

# date format. 0 - Month/Day/Year, 1 - Day/Month/Year
# Default value is 0
date=1

# font size (by default is current browser's font)
size=2

# font face (by default is current browser's font)
face=Arial,Times

# title. Default value is To Do
title=Sales team to do

# head. You can set here some file contains any html-code. This code will be
# outputted at the beginning of the each page. So you can set for example some banners.
# By default this value is empty
head=path_to_your_file
 

More about database persistence

All data will be saved in two tables. Names for tables are included in your configuration file (table2=first_table, table2=second_table). So if you support several collections each of them must have own pair of tables (probably in the same database). Tables must be created before the first use of servlet with the appropriate configuration file. Use your database admin tools for doing this. Here is a DDL statement for your tables:

CREATE TABLE first_table_name (
Id CHAR(30) PRIMARY KEY,
Priority INTEGER,
DueDate CHAR(8),
Done CHAR(1),
Category CHAR(30),
Msg CHAR(80),
Msg1 LONG VARCHAR);

CREATE TABLE second_table_name (
Id CHAR(30) PRIMARY KEY,
Name LONG VARCHAR);

You must use the same names for columns but depends on your database you can change the type for LONG VARCHAR columns. These columns (domains) will keep text data. You may decide to use TEXT for example. Check out your DB manual for supported SQL data types. You may also change types from CHAR to VARCHAR.

Notes:

1. Configuration file can be saved anywhere on your server. E.g. if you are using ToDoServlet?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 name for setting config file location: ToDoServlet?/home/users/my_file (or ToDoServlet?c:\users\my_file) or you may use a full path relatively to your root: ToDoServlet?/data/config.txt

2. Free version supports up to 5 notes per one collection.

    For downloading:   todoPackage.jar
    Sample of configuration file: todoconf

 © Coldbeans      Comments?

See also JSOS - the largest collection of servlets and filters.