Java Reference
In-Depth Information
Category getCategory(Integer categoryId) —to the interface. Then, we can con-
tinue coding without worrying about the implementation.
When the viewCategory method completes, it uses a public static String called
SUCCESS as the return value. The value of the SUCCESS variable is success . The
returned String is used to provide the BeanAction with the name of the action for-
ward to call. This results in our JSP display (see listing 14.10).
Listing 14.10
Product listing - /catalog/Category.jsp
<c:set var="category"
value="${catalogBean.category}"/>
<c:set var="productList"
value="${catalogBean.productList}"/>
B
Sets Category object and
productList to page scope
<table width="100%">
<tr>
<td colspan="2" class="PageHeader" align="left">
<c:out value="${category.name}"/>
</td>
</tr>
<tr>
<td colspan="2" align="left">
<html:link page="/index.shtml" styleClass="BackLink">
Return to Main Page
</html:link>
</td>
</tr>
C
Iterates over
productList
<c:forEach var="product" items="${productList}">
<tr>
<td width="128" align="center"
style="border-bottom: 1px solid #ccc">
<html:link paramId="productId"
paramName="product"
paramProperty="productId"
page="/viewProduct.shtml">
<c:out value="${product.image}"
escapeXml="false"/>
</html:link>
<html:link paramId="productId"
paramName="product"
paramProperty="productId"
page="/viewProduct.shtml">
View Items
</html:link>
</td>
<td align="left"
style="border-bottom: 1px solid #ccc">
D
Renders links
and display text
Search WWH ::




Custom Search