Chapter 8. Configuration Files

Table of Contents

8.1. Overview
8.2. Element dbforms-config
8.3. Element table
8.4. Element query
8.5. Element events
8.6. Element dbconnection
8.7. Element DOMFactoryClass
8.8. Element DefaultEscaperClass
8.9. Element interceptors

The root element surrounds the other elements. Only one dbforms-config element can appear in a file. XML namespaces are not used. The root element may be preceded by an XML declaration such as

   <?xml version="1.0" encoding="UTF-8" ?>

or an XML comment.

If you have a source distrtibution of DbForms and wish to validate your dbforms-config.xml file, the XML schema is located at src/org/dbforms/resources/dbforms-config.xsd relative to the root directory of the source distribution. The JEdit editor ( with the XML plugin may be used for this purpose. The Apache Xerces project ( also provides capabilities to validate an XML document against a schema. Two attributes may be needed in the dbforms-config element tag to allow the validation to occur.

   xsi:noNamespaceSchemaLocation="(your path to)/dbforms-config.xsd"

This element contains the fully-qualified class name to be used to escape database and other HTML content. Escaping is necessary to make sure that characters such as '<' and '>' in displayed data do not compromise the HTML structure of the DbForms page. A replacement escaper class might be needed if the DbForms default escaper class is not sufficient.

The element content between the start and end tags gives the class name. There are no attributes for the element.

See Chapter 15, Application hook-ups (Interceptors) for a more complete explanation of the use of this element. This element is used for declaring interceptor classes globally. It is also possible to declare interceptors within each table. See the table element earlier in this chapter. Globally declared interceptors are invoked for all tables but interceptors declared for specific tables are invoked only for that table. If both table-specific and global interceptors are defined, the table-specific iterceptor is invoked first and, if it signals success, the global interceptor is then invoked.

The nesting of subelements within the interceptors tag is shown below.


The interceptors subelement is optional but, if present, can only occur once. The <interceptors> tag encloses one or more interceptor elements. Within an interceptor element there may be zero or more param elements that provide fixed parameters to the instances of the interceptor class. None of these elements contain element content. Instead, all information is supplied in attributes.

The interceptors element has no attributes.

The interceptor element has a single required attribute className that gives the fully-qualified Java class name of the interceptor class. This class must implement the org.dbforms.config.DbEventInterceptor interface.

The param element has two required attributes, name and value. Attribute name gives the name of the parameter and the value attribute gives a string value for the parameter. These parameters are accessible via the servlet context which is made available to the interceptor class via the config parameter of type DbFormsConfig.