table element is perhaps the most
complex element. It contains the majority of the information needed
by DbForms to render the DbForms JSP tags. A
table element is needed for for each
table to be used with DbForms.
A starting set of
table elements as
well as a basic
can be generated using the DevGui tool. This tool, which is described in
Chapter 5, DevGui
verifies database connectivity and then uses JDBC
capabilities to query the metadata for tables in the database. This
can be a signficant time-saving step.
The nesting and ordering of subelements within each
table tag is shown below.
<table> <field/> <calc/> <foreign-key/> <events> <event/> </events> <interceptor> <param/> </interceptor> <granted-privileges/> </table>
The top level subelements,
granted-privileges may each occur
zero or more times except
which is optional but may appear a maximum of one time.
There is no element content in the any of the elements. All information is supplied in the attributes of these elements and the attributes of their subelements.
table element itself has one
name, giving the name of the table
and a number of optional attributes. All of the attributes are listed below.
classic", DbForms will use its original method of handling BLOBs which involved storing BLOB data in individual disk files. When this attribute is omitted or has any other value, the database management system is used to store BLOBs in appropriate table columns. When classic BLOB handling is used, the
fieldsubelements may be used to control where and how BLOB files are handled. Optional.
formatas a convenience when fields from the table are referenced as foreign keys. See Chapter 19, Foreign Key support within DbForms for more information. Optional.
visibleFieldsas a convenience when fields from the table are referenced as foreign keys. See Chapter 19, Foreign Key support within DbForms for more information. Optional.
field element describes a column
in the table. There are two required attributes,
name, giving the name of the column
in the table, and
the data type of the column. There are also many optional attributes.
All of the attributes are listed below.
String.startsWith()so, for example, Oracle's
varchartype listed below. Use of an unsupported column type will result in a Java exception while reading the
dbforms-config.xmlfile which will generally render the application unusable.
long varchar, and
aliasattribute in the enclosing
encodingis set to true, file names for BLOB objects are generated by DbForms so there is no possibility of one BLOB object overwriting another. If
encodingis false or is omitted, the remote file name of an uploaded BLOB file is used by DbForms. This means that files of the same name will overwrite each other. Optional.
calc element is similar to the
field element except that the
encoding attribute is not allowed. A
field defined within a
is not populated by the user. Rather, the value is generated by
Columns in a table that are foreign keys in the SQL sense should be
described in using the element
rather than the
element. This allows DbForms to handle the field differently. There
are limitations, however, on DbForms foreign key handling. See
Chapter 19, Foreign Key support within DbForms
for more details.
Every table uses, by default, the standard event configuration
established in the
nested directly within the root
dbforms-config element. A developer
can choose, however, to override the event class associated with a
certain type of event, by adding and configuring the
events element within a
events element itself is merely a
container for one or more
subelements within it. Element
has no attributes.
event element may have a number
of attributes and may enclose nested
param subelements. See
Chapter 22, Pluggable events
Section 22.5, “Override the event classes on a table-by-table basis ”
for more details.
interceptor element is used for
declaring interceptor classes locally for a particular table. See the
discussion later in this chapter on the
interceptor element for details of
the attributes and the
As mentioned in
Chapter 15, Application hook-ups (Interceptors)
it is also possible to
declare interceptors globally to apply to all tables. Globally
declared iterceptors 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.
By default, all users of the DbForms application have full access to
read and write all of the tables defined in
granted-privileges element has four
optional attributes that can establish limits for specific user roles.
The attributes are
delete. User roles are those defined
in the application
web.xml file. See
Chapter 9, Security
for more details.