Java Reference
In-Depth Information
Category
PK
Product
PK
Item
PK
categoryId
productId
itemId
name
FK1
categoryId
FK1 productId
color
name
name
description
description
description
image
image
listPrice
unitPrice
supplier
status
attr1
attr2
attr3
attr4
Figure 8.4
Our search form
attr5
So, how does the search page work with the database? Listing 8.10 shows part of
the answer.
Listing 8.10
SearchCriteria.java parameter class
public class ProductSearchCriteria {
private String[] categoryIds;
private String productName;
private String productDescription;
private String itemName;
private String itemDescription;
// setters and getters
}
Essentially, each field on the search page is mapped to a property on the search
criteria class, which is a simple JavaBean.
8.4.2
Defining the required input
We are going to break from the form we used in our previous example by deter-
mining the input requirements before we identify the database structures
involved. The user will perform searches based on five criteria. The list of criteria
will contain the categories, product name, product description, item name, and
item description. The product name and product description will allow for wild-
card searches using the standard database percent (%) syntax. There will be a
multiselect drop-down list that will allow users to narrow the search to a list of cat-
egories. With these complex input requirements, we will need to understand
Search WWH ::




Custom Search