bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Platform > WebLogic Portal > JavaServer Page Guide > Catalog Development JSP Tags |
JavaServer Page Guide
|
Catalog Development JSP Tags
The Commerce services included in the WebLogic Portal product suite provide JavaServer Page (JSP) templates and JSP tags that implement commonly used Web-based product catalog features. The Product Catalog JSP templates allow your customers to search for product items or browse through categories to locate items; the JSP tags are used to implement this functionality.
This topic includes the following sections:
Catalog JSP Tags
This section summarizes the tags that comprise the Product Catalog JSP tag library. These tags are used in the JSP templates that comprise the default Product Catalog. You can add or remove tags in your use of the JSP templates to match your specific formatting requirements.
Note: In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.
<catalog:getProperty>
Use the <catalog:getProperty> tag (Table 5-1) to retrieve a property for display from either a ProductItem or Category. The property can either be an explicit property (a property that can be retrieved using a get method on the Catalog item) or an implicit property (a property available through the ConfigurableEntity getProperty methods on the Catalog item). The tag first checks to see if the specified property can be retrieved as an explicit property. If it cannot, the specified property is retrieved as an implicit property. Table 5-1 describes the <catalog:getProperty> tag attributes.
Example 1 Listing 5-1 retrieves the detail JSP information from an existing ProductItem: Listing 5-1 Using <catalog:getProperty>; Example 1 Example 2 The following example shows how to use the getterArgument attribute to obtain an implicit or custom property for a property set/schema with the following characteristics:
<%@ taglib uri="cat.tld" prefix="catalog" %>
<catalog:getProperty
object="<%= item %>"
propertyName="Jsp"
getterArgument=
"<%= new Integer(ProductItem.DETAILED_DISPLAY_JSP_INDEX) %>"
id="detailJspInfo"
returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"
/>
Note: Because the getterArgument must be a run-time expression, we assign MyCatalog to a String variable and use the variable as the value to the getterArgument.
Listing 5-2 Using <catalog:getProperty>; Example 2
<%@ taglib uri="cat.tld" prefix="catalog" %>
<%
String myPropertySetName = "MyCatalog";
ProductItem myProductItem = .....; // reference to a ProductItem
%>
<catalog:getProperty
object="<%=myProductItem%>
propertyName="color"
getterArgument="<%=myPropertySetName%>"
/>
<catalog:iterateViewIterator>
Use the <catalog:iterateViewIterator> tag to iterate through a ViewIterator. A ViewIterator is an iterator over a potentially large collection of remote data that is broken up into a series of fixed sized Views. ViewIterators are returned from all Catalog service API methods that may potentially return a large set of ProductItems or Categories. This tag allows you to iterate the ViewIterator one item (ProductItem or Category) at a time (the default behavior) or by an entire View (fixed size set of ProductItems or Categories) at a time. It is important to note that this tag does not reset the state of the ViewIterator upon completion. Table 5-3 describes the <catalog:iterateViewIterator> tag attributes.
Example 1 Listing 5-3 displays the keys of all Categories in a ViewIterator: Listing 5-3 Using <catalog:iterateViewIterator>; Example 1 Example 2 The following example displays all the Views contained within a ViewIterator: Listing 5-4 Using <catalog:iterateViewIterator>; Example 2 <catalog:iterateThroughView>
<%@ taglib uri="cat.tld" prefix="catalog" %>
<catalog:iterateViewIterator
iterator="<%= myIterator %>"
id="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category">
<%= category.getKey().toString() %>
</catalog:iterateViewIterator><%@ taglib uri="cat.tld" prefix="catalog" %>
<catalog:iterateViewIterator
iterator="<%= myIterator %>"
id="view"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"
iterateByView="true">
<%= view.toString() %>
</catalog:iterateViewIterator>
The <catalog:iterateThroughView> tag (Table 5-4) iterates through a View of a specified ViewIterator. The tag will iterate the View one Catalog item at a time until the end of the View is reached. If you do not specify a specific View (by index) through which to iterate, the current View of the ViewIterator is used. It is important to note that this tag does not reset the state of the ViewIterator upon completion. Table 5-4 describes the <catalog:iterateThroughView> tag attributes.
Example 1 Listing 5-5 displays the keys of all the ProductItems contained in the current View of a specified ViewIterator: Listing 5-5 Using <catalog:iterateThroughView>; Example 1 Example 2 The following example displays the keys of all the ProductItems contained in the first View of a specified ViewIterator: Listing 5-6 Using <catalog:iterateThroughView>; Example 2
<%@ taglib uri="cat.tld" prefix="catalog" %>
<catalog:iterateThroughView
iterator="<%= myIterator %>"
id="item"
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem">
<%= item.getKey().toString() %>
</catalog:iterateThroughView><%@ taglib uri="cat.tld" prefix="catalog" %>
<catalog:iterateThroughView
iterator="<%= myIterator %>"
id="item"
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"
viewIndex="new Integer(0)">
<%= item.getKey().toString() %>
</catalog:iterateThroughView>
E-Business JSP Tags
This section summarizes the tags that comprise the E-Business JSP tag library.
A Scrollable Model is used to retrieve value objects so that only what is viewed is retrieved. The <eb:smnav> tag (Table 5-5) allows you to control the presentation of elements in the list of value objects that are being viewed, and provides links to the previous and next pages. The <eb: preface stands for e-business. The Scrollable Model can be use throughout the e-business package to iterate through a list of objects. It can be used in conjunction with transaction, shopping cart, order history, or shipping services. This tag relies on a Pipeline Session containing a ScrollableModel object on the PipelineSessionConstants.SCROLLABLE_MODEL key. Table 5-5 describes the <eb:smnav> tag attributes.
Example The orderhistory.jsp that is part of the Commerce services JSP templates allows a visitor to browse page by page over the set of orders placed. Only 10 orders are displayed at a time. To go to the next or to the previous page, the visitor clicks on the "Next" or "Previous" hyperlinks shown by the tag. In Listing 5-7, if the visitor has 40 orders and is viewing the second page, the tag will be displayed as "Previous | 20-29 | Next". Listing 5-7 Using <eb:smnav>
<%@ taglib uri="eb.tld" prefix="eb" %>
<!-- Show the Previous / 10-19 / Next navigation string -->
<eb:smnav origin="orderhistory.jsp" event="link.viewOrderHistory"
prevstring="Previous" nextstring="Next"
pageindex="<%=pageIndexString%>" />
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |