Java Reference
In-Depth Information
Our presentation bean with properties and behaviors to capture visitor
input (see listing 14.9)
A JSP page that lists products of a category (see listing 14.10)
Then we'll add an action mapping to our Struts configuration.
Since what we are about to code involves the use of the category, let's go ahead
and create this object in the org.apache.ibatis.jgamestore.domain package as Cat-
egory.java . The Category domain object (listing 14.7) is a simple object that con-
sists only of a categoryId , a name, a description, and an image. Since our category
is never more than one level deep, we won't need to concern ourselves with any
parent categories.
Listing 14.7
Category domain object
public class Category implements Serializable {
private String categoryId;
private String name;
private String description;
private String image;
// simple setters and getters
The code we are writing will also involve the use of the Product domain object
(listing 14.8). The product objects will be loaded in a list for display on the JSP
page. This means that the product will not be accessed directly by any Java code at
this point. Regardless, it will be smart to code it for the sake of thoroughness. Let's
add it to the org.apache.ibatis.jgamestore.domain package as Product.java . The
Product object will consist of a productId , categoryId , name, description, and
image. Product is not much different from the Category domain object except
that the Product domain object contains an associated categoryId .
Listing 14.8
Product domain object
public class Product implements Serializable {
private String productId;
private String categoryId;
private String name;
Search WWH ::




Custom Search