DbForms application JSPs contain tags for building the application functionality. These tags are defined in the tag library document, not in this section.
The application web deployment descriptor file
web.xml
must contain specific content
for DbForms. See
Section 4.3, “Building your own DbForms-capable applications”
and, in particular,
Section 4.3.1, “Edit deployment descriptor web.xml
”
for more information
about the requirements for web.xml
.
The other key application configuration file is dbforms-config.xml
which is the subject of the remainder of this chapter.
Errors in this file often cause errors in the execution of a DbForms web application. Whenever a change is made to this file, it is wise to check the servlet engine log files for any errors listed there.
The dbforms-config.xml
is read when
the servlet container is started or when the web application is
reloaded. If there are any errors in this file, the DbForms parser
will abort with an exception. The web application will then be left
in an indeterminate state. Typically, the servlet engine (such as
Tomcat) will continue to service requests for the web application but
these will encounter a error such as a Java "No DbConnection object
configured with name 'null'" exception.
Setting up the configuration file
dbforms-config.xml
is an important
part of creating a DbForms application. This file defines the set of
database tables to be used, defines the database connectivity needed to
perform operations, and supplies information and parameters for
more advanced capabilities such as
interceptors and defined queries. The
DevGui tool described in
Chapter 5, DevGui
provides an easy
way to create an initial version of
dbforms-config.xml
.
DevGui uses JDBC to connect with your
database and automatically extract table definitions needed for
DbForms.
The top level structure of the
dbforms-config.xml
file is shown
below. The root element is
<dbforms-config>
and this, of
course, occurs only one time. The seven subelements shown inside of the
root element must appear in the order shown.
<dbforms-config> <table></table> <query></query> <events></events> <dbconnection></dbconnection> <DOMFactoryClass></DOMFactoryClass> <DefaultEscaperClass></DefaultEscaperClass> <interceptors></interceptors> </dbforms-config>
The first four subelements, with tags
<table>
through
<dbconnection>
, can appear zero
or more times. The remaining subelements, tags
<DOMFactoryClass>
through
<interceptors>
, may occur zero
or one time. Since all subelements are optional, an empty root tag is
valid although not useful.