Java servlets based implementation of HTML-based tree control.
How to use it:
a) copy treePackage.jar into WEB-INF/lib directory
b) describe Tree servlet in your web.xml file:
<servlet>
<servlet-name>TreeServlet</servlet-name>
<servlet-class>com.jsos.tree.TreeServlet</servlet-class>
</servlet>
c) describe a mapping for this servlet:
<servlet-mapping>
<servlet-name>TreeServlet</servlet-name>
<url-pattern>/servlet/TreeServlet</url-pattern>
</servlet-mapping>
The usage is: http://your_host/servlet/TreeServlet?config_file
Runs servlet and uses the mentioned file as a configuration file.
Alternatively you may describe configuration file as an initial parameter
for this servlet (parameter name is config):
<servlet>
<servlet-name>TreeServlet</servlet-name>
<servlet-class>com.jsos.tree.TreeServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>path_to_your_configuration_file</param-value>
</init-param>
</servlet>
and run servlet this way: http://your_host/servlet/TreeServlet
Configuration file describes HTML settings and data file. Data file contains information about tree structure and interface settings.
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:
#
# tree settings
#
# background color (default value is #FFFFFF)
bgcolor=#FFFFCC
# foreground color (default value is #000000)
fgcolor=#000000
# font size (by default is default browser's font size)
size=2
# font face (by default is default browser's font size)
face=Arial
# you may set also your own pictures for opened and closed nodes
# By default they are - and +
# opened node (default value is -)
opened=path_to_your_image_file
# closed node (default value is +)
closed=path_to_your_image_file
# data file. This parameter is mandatory
data=path_to_your_data_file_is_here
# header. You can set here some file contains any html-code. This code
will be
# outputted at the beginning. So you can set for example
some banners or CSS styles.
# By default this value is empty
header=path_to_your_file
# footer. You can set here some file contains any html-code. This code
will be
# outputted at the bottom of the each page. So you can set for example
some banners.
# By default this value is empty
footer=path_to_your_file
# dhtml support
# enables/disables DHTML usage for this control
# Possible values are 0, 1. Default value is 0 (disabled)
dhtml=1
Data file describes your tree. This text file will be parsed during
the first call for this servlet with the appropriate configuration file.
Each line describes one node. Empty lines and lines starts with # or // are
ignored. Node has got the following form:
identification
name action
Identification is any sequence of symbols. Each node should have own
unique ident. Name is a visible representation for this node. Action is
an element for the hyperlink (possible empty). Elements are delimited by
the tabulator. End for the each node should be marked on the separate line starts with
/identificator. E.g. suppose we have the following tree structure:
| Node 1 | ||
| ||
| Node 3 |
than we can describe this in our data file this way:
node1 This is node 1 http://www.servletsuite.com
node2 This is node 2(subnode)
http://www.servletsuite.com/servlets.htm
/node2
/node1
node3 this is node 3 (on the same level as a node1)
/node3
Remarks:
1. If you are using tree in frames you can set target frame
as a part of action. E.g.:
node Node name
http://action.org target=another_frame
2. Configuration file can be saved anywhere on your server. E.g. if you are using TreeServlet?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: TreeServlet?/home/users/my_file (or TreeServlet?c:\users\my_file)
3. Data file can be saved anywhere on your server. You can always use the full path when you describe data element in your configuration file.
4. Free version supports up to 5 top level's nodes.
For downloading:
servlet: treePackage.jar
| Samples of: | tree configuration data file |
opened.gif
opened1.gif
closed.gif
closed1.gif
|
See also JSOS - the largest collection of servlets and filters.