Java Reference
In-Depth Information
Figure 11-5: Database searches are performed using an HTML Search Form
Table 11-4: Part of Options Table
Tow_Bar
4WD
Other
List
0
0
AM/FM Radio, Cassette, Moon roof, Power
windows
0
1
Entertainment
center
AM/FM Radio, CD Changer, Moon roof
1
0
AM/FM Radio, CD, Power locks,Power
windows
Tables used for photos and text objects
The tables discussed up to this point are structured so that they are easy to search. Support for easy
searching has been carried through to the HTML forms used to populate the tables. The database
includes the following additional tables that are not searchable:
 
Photos, which contains member photos as blobs
 
BodyText, which contains free-form text
These tables are also accessed using the MemberID. The Photos Table uses MemberID as a foreign
key, because the primary key is the PhotoID. The Photos Table is interesting primarily because it stores
the photos as blobs. These require special handling, since they are accessed as streams or byte arrays
using pointers known in SQL terminology as locators . Uploading photos from a browser is also an
interesting topic, since it involves special handling not included in the basic HTML form support that the
servlet object provides.
Cross-
Reference
Chapter 14 explains how to use a servlet to upload images from a browser
page and store them in a database as blobs.
Once the data has been stored in the database, it is accessible to members via a search form. The
search capabilities of the Web site are discussed in the next section .
Searching the Database
Searches of the database are carried out using the search form illustrated in Figure 11-5 . Notice the
similarities between the search form and the data entry form of Figure 11-3 .
The results of a search are presented in summary form, showing several database item summaries per
page. Each summary item includes a thumbnail image that is downloaded from the database using a
servlet. The general appearance of a summary is shown in Figure 11-6 .
Search WWH ::




Custom Search