Java Reference
In-Depth Information
fieldValues = fieldValues.substring(0,fieldValues.length()-1);
// create SQL command
SQLCommand = "INSERT INTO " + tableName + " ("+fieldNames+") "+
"VALUES ("+fieldValues+")";
Cross-
Reference
Chapter 12 explains how servlets and JSP pages work and how to use them
to handle HTML forms.
This generic approach to handling the form data means that although the table structures have to track
the HTML forms, the middle-tier code can be independent of both. This approach makes maintenance
much easier, since you may find that you have to add new tables or modify existing tables.
Like the Product_Info Table, most of the tables are completed using data from forms designed to
minimize data-entry errors. In this case, most of the entries are made using check boxes, as shown in
Figure 11-4 .
Figure 11-4: Data entry form using check boxes
As you can see, a single free-form text field supports the check boxes, as shown in Figure 11-4 . Again,
the rationale for this approach is to minimize data-entry errors. The check boxes map to boolean
variables that are quick and easy to search. Assuming that most of the popular options are covered by
the check boxes, the free-form text entries can simply be ignored for search purposes.
Table 11-4 shows a simplified subset of the table completed using the HTML form of Figure 11-5 . The
most significant column in Table 11-4 is the List column, which is used to provide a summary of the
items in the table for display purposes. The data for this column is synthesized when the table is
updated by creating a string from all the data-entry field names, plus the contents of the "Other options"
field.
Search WWH ::




Custom Search