MessageBoard servlet 2.7

This is a Java servlet implements message board. Board supports e-mail notification and WAP/WML clients.

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

How to use it:

a) copy messageBoardPackage.jar into your WEB-INF/lib directory.
b) define servlets in your web.xml file. There are two servlets: MessageBoard for board itself and AdminBoard for administration:



c) describe a mapping for servlets in web.xml file:



For each your board you must provide a configuration file describes how to save messages as well as various interface settings. You can use MessageBoard (or AdminBoard) 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/MessageBoard

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:

# Persistence

# base directory, this parameter must be set
# in case of file based persistence.
# Points to any existing directory on your server.

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

# JNDI name (instead of the above mentioned pair)

# Optional parameter: user name for JDBC connection. You can omit this parameter.
# Optional parameter: password for JDBC connection. You can omit this parameter.

# name of the table
# See below DDL description for this table

# Directory for uploaded files. If you set this parameter
# users will be able to add attachments to own messages

# Interface

# board title (default value is empty - no title)
title=My Forum

# CSS Style (URL for your file)

# background (default value is #FFFFFF)

# foreground color (default value is #000000)

# You can use also different backgrounds for odd and even messages in the list
# odd messages background. Default value is #D6E6E1

# even messages background. Default value is #F7F7F7

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

#font face (by default is current browser's font)

# offset. By default board will use server's time (offset=0). You can
# set here time offset (+hours or -hours) if servlet is hosted in
# the another time zone.

# sort titles (creation time): 1 - last to first, 0 - first to last (default value is 1)

# sort messages (posting time): 1 - last to first, 0 - first to last (default value is 0)

# refresh time in seconds (default value is 600)

# enable/disable post messages. By default this parameter is empty
# and posting is enabled for everyone.
# You can provide here a commas separated list of roles for users allowed
# to post data

# page size in messages (default value is 10)

# header. You can set here some file contains any html-code. This code will be
# outputted at the top for each page. So you can set for example some banners or CSS styles.
# By default this value is empty

# footer. You can set here some file contains any html-code. This code will be
# outputted at the bottom for each page.
# By default this value is empty

# Date format. By default board will use full date.
# You may set here your own format for date. E.g.:
date=dd/MM/yyyy hh:mm

# ask email: ask/do not ask email field for posted messages.
# Possible values are 1 (ask) or 0 (do not ask).
# Default value is 1. E.g.:

# ask URL: ask/do not ask URL field for posted messages.
# Possible values are 1 (ask) or 0 (do not ask).
# Default value is 1. E.g.:

# localization support. You can set character encoding for input parameters
# here. Default value is ISO-8859-1

# localization support. You can directly describe charset
# for output. By default servlet will use browser's settings.
# E.g. for chinese you may use this:

#Password for administrator. Will be used in AdminBoard servlet.
# Default value is welcome
# admin=your_password

# you can set also smtp server parameters in case of you are going to use e-mail notification

# smtp port. By default is 25

# smtp host

# your mail domain

# from address. Address 'From' for notification letters

# to address. Notification will be emailed to any user
# who select 'Notify me' in the dialogue.
# But you can also send mail to specified address about
# any changes in board's data. This address is described as a 'to' parameter.
# (e.g. your administrator).

You can save config file anywhere on your server. Just use the proper path for setting servlet's parameter. Short path (just name of the file) means that your configuration file is saved under servletrunner's root directory. But you can always use some like this:


or you may use a full path relatively to your root:


Also the base directory for messages store can be created at the any place on your server (just check out access rights).

CSS settings

You can describe your own CSS styles for message board. Use the following classes:

message - CSS styles for textarea input
attribute - CSS styles for input text fields

More about database persistence

All data will be saved in the one table. Name of this table is included in your configuration file (table=your_table). So if you support several calendars each of them has got own table (probably in the same database). Table 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 this table:

CREATE TABLE your_table_name (
Id1 CHAR(30),
Moment CHAR(14),
Subject CHAR(80)
Author CHAR(255),
Email CHAR(80),
Url CHAR(80),
Attach CHAR(255),
Notify CHAR(1));

You must use the same names for columns but depends on your database you can change the type for the column (Msg). This column (domain) will keep text data for individual messages. You may decide to use TEXT for example. Check out your DB manual for supported SQL data types.

Domain Moment will keep time stamp for messages (in milliseconds). We used type CHAR just for the compatibility with JDBC-ODBC bridges. You may also change types from CHAR to VARCHAR.

Note: evaluation version displays only first three pages for the each thread.

For downloading:   messageBoardPackage.jar   

Sample of config file: mbconf

 © Coldbeans     Comments?

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


Also in JSOS: