Java Reference
In-Depth Information
name="catalogBean" parameter="index"
<forward name="success" path="index.tiles"/>
In the JGameStore application, the index() method of the CatalogBean makes a
call to the CatalogService to populate a List of the newest products from each
category. Since we provide a better example of this bit later, we won't explain it
here. At this point, we'll just accept that the index() method returns a success
String and is forwarded to the first page in the cart (see listing 14.5).
Listing 14.5
index() method of catalogBean
public String index() {
return SUCCESS;
Next, we can use our index.jsp to successfully forward to the main page through
the Struts controller. There is nothing to the index.jsp except a forward. Be sure
to specify the .shtml extension on your forward URL so that your servlet container
will route the request through the Struts controller (see listing 14.6).
Listing 14.6
JSP forward
<jsp:forward page="/index.shtml"/>
Next, you'll learn how to set up a presentation bean and create a behavior
method that can be called.
Utilizing a presentation bean
When visitors arrive at the cart, they select a category they wish to examine. Our
next step is to capture the category and display a listing of products on a subse-
quent page. To achieve this, we need to create the following:
A tiles definition in our tiles-defs.xml
Our Category domain object (see listing 14.7)
Our Product domain object (see listing 14.8)
Search WWH ::

Custom Search