The process consists of a few basic steps:
Describe how the data will be retrieved and displayed.
Determine which database structures are involved.
Write out the SQL in static form.
Apply Dynamic SQL tags to static SQL .
This is a pretty simple page but, as you know, there is always more behind it than
meets the eye. So in the following sections, we'll look at the code to make this work.
Defining how to retrieve and display data
On each page of the JGameStore application we want to implement a simple
search field with a search button. The search field will tokenize terms by spaces.
For example, if we enter Adventure Deus the two terms will be Adventure and
Deus . Each term should check for an inclusive match against the product's cate-
goryId , name, and description. Once the search button is clicked, any resulting
products should be paged in increments of four.
Determining which database structures are involved
Let's move on to defining which table structures are involved.
Since we are only searching against the categoryId , name,
and description, we will require only the Product table to ful-
fill our requirements (figure 8.3). The Product table contains
all of the individual product information that we will need
for search and display.
Writing the SQL in static format
For starters we will construct some static SQL that will select
all the necessary fields we will need to display in our search
results. Listing 8.8 shows the static query we have assembled
to accomplish the display of product information.
Figure 8.3 Diagram
of the table involved
in the simple product
Static SQL mock-up