BEA Logo BEA WebLogic Commerce Server Release 3.1.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic Commerce Server Doc Home   |   Product Catalog Management   |   Previous Topic   |   Next Topic   |   Contents   |   Index

The Product Catalog JSP Templates and Tag Library

 

The BEA WebLogic Commerce Server provides 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.

When you click the Add to Cart button on the JSPs that provide item details, the default Webflow for the WebLogic Commerce Server Web application passes data about the selected product items to the order management JSPs. For information about the JSPs that comprise the Order Processing package, see BEA WebLogic Commerce Server Order Processing Package.

This topic includes the following sections:

 


Introduction

The JSP templates and JSP tags included in the BEA WebLogic Commerce Server allow you to easily customize the presentation of the product catalog. The names of the JSPs for categories and product items are stored in the database as attributes of the categories and items. (See The Product Catalog Schema, for information about the DISPLAY_JSP_URL column in the WLCS_CATEGORY database table, and the SUM_DISPLAY_JSP_URL column [a pointer to the item's summary page] and the DET_DISPLAY_JSP_URL column [a pointer to the item's detail page] in the WLCS_PROD_ITEM database table.)

The Commerce Server product catalog integrates with the Webflow engine, which automatically selects the appropriate JSP for displaying a particular category or product item. The Webflow is set by entries in the webflow.properties file, as explained in the BEA WebLogic Commerce Server Webflow and Pipeline Management documentation.

JSP tag libraries allow you to easily retrieve the attributes of items and categories in the product catalog. You can then format these attributes using HTML tags. Any HTML editor can be used to create custom layouts. You can also include custom Java code within the JSPs to display categories and items.

 


JSP Templates Overview

The BEA WebLogic Commerce Server provides a number of JSP templates that span the start-to-finish experience for a Web site user who is shopping on your site. There are several sequence paths through the system; the following list outlines one possible path.

  1. If the customer has previously registered and logged in, display a home page that welcomes the customer, and include links to the customer's Order History and Payment History. Otherwise, just display a generic home page.

  2. Search for or browse product items in the catalog.

  3. Add one or more items to a shopping cart.

  4. Enter or update the customer's profile information, such as their default shipping address, default credit card billing address, and credit card number (encrypted).

  5. Checkout.

  6. Review an order.

  7. View a confirmation of an order.

  8. Optionally check the status of an order.

On Which JavaServer Page Will My Users Start?

Before you can understand which JavaServer Page your users will open first, it is important to understand how your catalog and order fulfillment system will eventually be deployed. This section introduces that topic, and you can follow along by opening the referenced files in the installed WebLogic Commerce Server directories.

Web Applications and the weblogic.properties File

The JSP templates and all the supporting Java packages are configured to run as a Web application on the WebLogic Server. In the weblogic.properties file that resides in the WL_COMMERCE_HOME directory, the following property is used to identify each Web application:

weblogic.httpd.webApp.myapp=location

The myapp parameter is the context name given to the Web application, and is included in the initial part of any URL request to the Web application. The location parameter is the root directory of the Web application, or the location of the Web Archive (.war) file that contains the Web application archive.

The two Web applications for the WebLogic Commerce Server are:

weblogic.httpd.webApp.tools=location
weblogic.httpd.webApp.wlcs=location

When you installed the WebLogic Commerce Server, the installation procedure substituted the directory path in the location parameter. For example, if you installed the BEA WebLogic Commerce Server product on a Windows system to d:\WebLogicCommerce, the Web application properties would be defined in the WL_COMMERCE_HOME\weblogic.properties file as shown in Listing 5-1.

Listing 5-1 WLCS/Tools Application Definitions in the weblogic.properties File


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# BEA WEBLOGIC COMMERCE SERVER WEB APPLICATIONS
# ------------------------------------------------
# Defines the admin tools Web Application.
weblogic.httpd.webApp.tools=d:/weblogiccommerce/server/webapps/admin/
# Defines the wlcs Web Application.
weblogic.httpd.webApp.wlcs=d:/weblogiccommerce/server/webapps/wlcs/


The Web application named tools comprises all the administration tool JSPs, Java packages, and related files. The Web application named wlcs comprises all the catalog and order fulfillment JSPs, Java packages, and related files.

XML Deployment Descriptor Files

All other configuration information for the Web applications is described in each one's XML deployment descriptor files. The WebLogic Commerce Server Web application's web.xml deployment descriptor file resides in the following directory:

%WL_COMMERCE_HOME%\server\webapps\wlcs\Web-inf\web.xml (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/Web-inf/web.xml (UNIX)

Included in the web.xml file for the WebLogic Commerce Server Web application is a setting for the initial page, or welcome page of the application, as shown in Listing 5-2.

Listing 5-2 Setting for Welcome Page in the web.xml File


<!-- Welcome file for the WLCS -->
<welcome-file-list>
<!-- This is the entry point to a WLCS site.
Change this appropriately -->
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>


For the WebLogic Commerce Server Web application, the index.jsp file resides in the root directory for the application, or in:

%WL_COMMERCE_HOME%\server\webapps\wlcs\index.jsp (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/index.jsp (UNIX)

commercewf Property Set and DestinationDeterminer

If you open index.jsp with a text editor, you will see that it has a single line of JSP code, as follows:

<jsp:forward page="/application/commercewf"/>

The WebLogic Commerce Server Web application uses an application initialization property set named commercewf. This property set specifies a DestinationDeterminer property that has the following value:

com.beasys.commere.webflow.DestinationDeterminer

To see the commercewf property set definition yourself, start by opening the Administration Tools home page at:

http://localhost:7501/tools/application/admin

On this page, select the Property Set Management link. On the Property Sets page, under the Application Initialization Property Sets heading, select the commercewf property set's link. The Property Set page for commercewf is displayed, as shown in Figure 5-1.

Figure 5-1 Property Set Page for commercewf

The com.beasys.commerce.webflow.DestinationDeterminer reads values from the webflow.properties file. This file sets the order in which the JSPs, input processors, and Pipelines are executed, based on the activity initiated by a user of the Web site. The JSPs control the presentation of the information, while the input processors and Pipelines manage the business logic.

Notes: The webflow.properties file resides in WL_COMMERCE_HOME.

For more information about the webflow.properties file, see the BEA WebLogic Commerce Server Webflow and Pipeline Management documentation.

In the first line of the webflow.properties file that is not a comment, the initial step involves obtaining the parameters for the catalog's top-level categories. This is accomplished by the GetTopCategories input processor, which if successful, initiates execution of the GetTopCategories Pipeline. If both of these mechanisms have executed successfully, the main.jsp template is sent to the browser, as shown in Listing 5-3.

Listing 5-3 Webflow Processing Leading to the Display main.jsp


begin=GetTopCategories.inputprocessor
.
.
.
GetTopCategories.inputprocessor.success=GetTopCategories.pipeline

# Now display the main page
GetTopCategories.pipeline.success=commerce/main.jsp


Thus, when the initial page is opened in a browser and the URL references the context name for the WebLogic Commerce Server Web application (wlcs), the first JSP that is displayed (already populated with values from the Pipeline) is the main.jsp template.

Note: Although the begin state is only set the first time the page is accessed, the process of obtaining the product catalog's top categories is initiated by the Webflow each time a customer attempts to access the home page, as shown in the following webflow.properties statement:

*.jsp.link(home)=GetTopCategories.inputprocessor

Sequence Review and the Browser View

Let's review how these files and parameters are working in sequence to open the initial page of the catalog/order site in a customer's browser:

  1. The server is started by running the StartCommerce.bat (Windows) or StartCommerce.sh (UNIX) procedure from a system prompt. This procedure resides in WL_COMMERCE_HOME, the top-level directory where you installed WebLogic Commerce Server. The procedure sets up the run-time environment for WebLogic Commerce Server and starts the WebLogic Server.

  2. As the WebLogic Server starts, it finds the properties defined in many *.properties files, including the weblogic.properties file that resides in WL_COMMERCE_HOME. In this file, the weblogic.httpd.webApp.wlcs property deploys the wlcs Web application on the WebLogic Server and specifies the root directory of the application. Consequently, the Web application server knows that the wlcs context name is included in the initial part of any URL request of the Web application.

  3. You can see this in action by opening http://localhost:7501/wlcs/ in a browser. (Prerequisite: start the server on your machine as described in step 1).

  4. When the page loads, notice how the server switches the URL in your browser's Address/Location bar to:

    http://localhost:7501/wlcs/index.jsp

    This is because the web.xml file for the wlcs Web application specified index.jsp as the initial page in the <welcome-file> XML tag.

  5. The index.jsp page simply references the /application/commercewf/ application initialization property set.

  6. The commercewf property set defines a DestinationDeterminer property. The default value is com.beasys.commere.webflow.DestinationDeterminer.

  7. The Webflow DestinationDeterminer Java class reads values from the webflow.properties file.

  8. The webflow.properties file includes a few initial steps (carried out by the GetTopCategories input processor and corresponding Pipeline) to get category data. Then, on successful completion, the Webflow calls for display of the main.jsp template, as shown below:

    GetTopCategories.pipeline.success=commerce/main.jsp

    Note: For more information about the main.jsp template, see main.jsp Template.

Figure 5-2 shows a portion of the Web application's home page. Notice that before we click on any links on this page, the URL is http://localhost:7501/wlcs/index.jsp but the displayed template is main.jsp.

Figure 5-2 Home Page Display for the WLCS Application

When you take any action on the page, the convention for the URI is to combine the /wlcs/ context name for the Web application, the /application/commercewf/ property set name, and the result of the operation with the Webflow and Pipeline processing. For example, if you click the A category in the Store Catalog, the URI changes to:

http://localhost:7501/wlcs/application/commercewf?origin=main.jsp&event=link(browse)&wlcs_catalog_sourceKey=wlcs_categories&wlcs_catalog_destinationKey=wlcs_siblings&wlcs_catalog_category_id=1

Figure 5-3 shows a portion of this URI on the resulting page, which displays the browse.jsp template.

Figure 5-3 Resulting URI, From main.jsp to browse.jsp in the A Category

In this way, the flow of presentation-level JavaServer Pages and the processing of the business logic by input processors and Pipelines are all operating in the context of the running WebLogic Commerce Server Web application. The JSPs are not simply linked from one JSP file to another JSP file.

 


JavaServer Pages (JSPs)

The WebLogic Commerce Server Web application contains a number of JavaServer Pages (JSPs) that allow your customers to display a catalog's categories and product items. You can choose to utilize these pages in their current form, or adapt them to meet your specific needs. This section describes each page in detail.

Note: For a description of the complete set of JSPs used in the WebLogic Commerce Server Web application and a listing of their locations in the directory structure, see the Summary of JSP Templates documentation.

Figure 5-4 illustrates the JSP templates that participate in the product catalog portion of the Webflow.

Figure 5-4 Flow of Catalog JSP Templates

main.jsp Template

The main.jsp template is the default home page for the product catalog. As noted in On Which JavaServer Page Will My Users Start?, the WebLogic Commerce Server Web application's home page is actually index.jsp. However, index.jsp refers processing to an application/commercewf/ property set, which defines a Java class that reads values from the application's webflow.properties file. In the webflow.properties file, the initial steps involve looking up the catalog's top-level categories (from in-memory cache or, if necessary, from the Commerce database). If these categories can be successfully located, the main.jsp template will be loaded to display them.

Sample Browser View

Figure 5-5 shows an annotated version of the main.jsp template. The dashed lines and numbers in the diagram are not part of the template; they are referenced in the explanation that follows the screen shot.

Figure 5-5 Annotated main.jsp Template Before User Login

The numbers in the following list refer to the numbered regions in the figure:

  1. The page header is created from an import of the header.jsp template. This is standard across most of the JSP templates provided by WebLogic Commerce Server. The import call is:

    <%@ include file="/commerce/includes/header.jsp" %>

    The header.jsp file creates the top banner and reserves space for the left-side column. The contents of the column are determined by other processing. In this example, only the quicksearch.jsp resides in the left column (see item 3 in this list).

  2. The content in region 2 on the main.jsp template is generated by a series of Pipeline JSP tags that obtain the top category (in this case, the root category for the entire catalog) and use it to obtain all of its subcategories. Then, the Pipeline JSP tags display each category name in a hyperlinked list.

  3. The content in region 3 depends on whether the user is logged in. (In the figure, the user had not logged in.) For that reason, only the quicksearch.jsp template is shown. The quicksearch.jsp template is always included into the main.jsp template. The include statement is:

       <%@ include file="/commerce/catalog/includes/quicksearch.jsp" %>

    However, if the user is logged in, the user is considered a registered customer, welcomed with a greeting, and presented with links to View Order History and View Payment History. In addition, the customer can choose to Logout of their account. Figure 5-6 shows only the left-side column when a user is logged in:

    Figure 5-6 Left-column of main.jsp When the User is Logged In

  4. The main.jsp template's content in region 4 contains the included footer.jsp template. The include statement is:

    <%@ include file="/commerce/includes/footer.jsp" %>

    The footer.jsp file consists of the horizontal footer at the bottom of the page, plus the right-side vertical column that describes (for the benefit of you and your development team) the name of the current template and links to its About information. In the footer.jsp file, the right-side vertical column is also an include file:

    <%@ include file="/commerce/includes/rightside.jsp" %> 

Location in the WebLogic Commerce Server Directory Structure

You can find the main.jsp file at the following location, where WL_COMMERCE_HOME is the directory in which you installed WebLogic Commerce Server:

%WL_COMMERCE_HOME%\server\webapps\wlcs\commerce\main.jsp (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/main.jsp (UNIX)

Tag Library Imports

The main.jsp template uses Pipeline, Catalog, and the WebLogic Personalization Server's User Management JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="pipeline.tld" prefix="pipeline" %>
<%@ taglib uri="cat.tld" prefix="catalog" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld. For more information on the WebLogic Personalization Server's User Management JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

These files reside in the following directory for the WebLogic Commerce Server Web application:

%WL_COMMERCE_HOME%\server\webapps\wlcs\WEB-INF (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/WEB-INF (UNIX)

Java Package Imports

The main.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="com.beasys.commerce.webflow.*" %>
<%@ page import="com.beasys.commerce.foundation.pipeline.*" %>
<%@ page import="com.beasys.commerce.ebusiness.catalog.*" %>
<%@ page import="com.beasys.commerce.webflow.tags.WebFlowTagConstants" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>

Location in the Default Webflow

The main.jsp template is the first page you or your customers will see upon starting the WebLogic Commerce Server Web application. From this page, customers can browse the store catalog by clicking on a link to a particular category (which loads the browse.jsp template). Customers can also enter keywords and click the Find button to perform a Quick Look-up of a particular product item (which loads the searchresults.jsp template). If the customer is logged into the site, the customer can also choose to logout (which loads a different version of the main.jsp template), view their order history (which loads the orderhistory.jsp template), or view their payment history (which loads the paymenthistory.jsp template).

Note: For more information about the default Webflow, see Figure 5-4.

Included JSP Templates

The following JSP templates are included into the main.jsp template:

Events

Every time a customer clicks a link or a button on the main.jsp template, it is considered an event. Each event triggers a particular response in the default Webflow that allows the customer to continue. While this response can be to load another JSP, it is usually the case that an input processor and/or Pipeline is invoked first. Table 5-1 provides information about these events and the business logic they invoke.

Table 5-1 main.jsp Events

Event

Webflow Response(s)

link(logout)

LogoutCustomerIP

link(viewOrderHistory)

RefreshOrderHistory

link(viewPaymentHistory)

RefreshPaymentHistory

link(browse)

BrowseCategory (IP)
MoveSiblingResults (IP)
GetBrowseDetails

Table 5-2 briefly describes each of the Pipelines from Table 5-1, as they are defined in the pipeline.properties file. For more information about individual Pipeline components, see Pipeline Components.

Table 5-2 main.jsp Pipelines

Pipeline

Description

RefreshOrderHistory

Contains RefreshOrderHistoryPC and is not transactional.

RefreshPaymentHistory

Contains RefreshPaymentHistory and is not transactional.

GetBrowseDetails

Contains GetCategoryPC, GetParentPC, GetSubcategoriesPC, MoveAttributePC, GetCategoryPC, GetAncestorsPC, GetSubcategoriesPC, GetProductItemsPC and is not transactional.

Dynamic Data Display

One purpose of the main.jsp template is to decide which version of the left column to display (the one with just the Quick Look-up or the one with links to customer-specific data). This is accomplished on the main.jsp template using a combination of Pipeline JSP tags and the WebLogic Personalization Server's User Management JSP tags.

First, the getPipelineProperty Pipeline JSP tag obtains the USER_NAME attribute from the Pipeline session. Table 5-3 provides more detailed information on this attribute .

Table 5-3 main.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.
USER_NAME

java.lang.String

The customer's username, if available.

Listing 5-4 illustrates how this attribute is obtained from the Pipeline session using the getPipelineProperty Pipeline JSP tag.

Listing 5-4 Obtaining the USER_NAME Attribute


<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.USER_NAME%>"
returnName="userName"
returnType="String"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, the main.jsp template checks to see if there is a value assigned to the username. If so, the getProfile User Management JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, and the left column is displayed with links to customer-specific data. Otherwise, just the Quick Look-up is shown. This functionality is shown in Listing 5-5.

Listing 5-5 Displaying the Left Column of main.jsp


<% if (userName != null && userName.length() != 0) { %>

<!-- Tag to get customer profile -->

<um:getProfile 
profileKey="<%=request.getRemoteUser()%>"
profileType="WLCS_Customer" />

<p><font color="#567856"><b>Welcome<br>

<um:getPropertyAsString propertyName="firstName" /> <um:getPropertyAsString propertyName="lastName" />:</b></font></p>

<p>This is BEA WebLogic Commerce Server</p>

<p class="commentary">
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext,
"main.jsp", "link(logout)", true) %>">Logout</a></p>

<hr size="1">

<p><font color="#567856"><b>Customer Service:</b></font></p>

<p class="commentary">
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext,
"main.jsp", "link(viewOrderHistory)", true)%>">View order
history</a></p>

<p class="commentary">
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext,
"main.jsp", "link(viewPaymentHistory)", true) %>">View payment
history</a></p>

<hr size="1">

<% } %>

<%@ include file="/commerce/catalog/includes/quicksearch.jsp" %>


Note: For more information on the WebLogic Personalization Server's User Management JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

However, the primary purpose of the main.jsp template is to dynamically display product catalog data by category. This is accomplished using a combination of Pipeline and Catalog JSP tags.

First, the getPipelineProperty Pipeline JSP tag obtains the CATALOG_CATEGORY and CATALOG_CATEGORIES attributes from the Pipeline session. Table 5-4 provides more detailed information on these attributes .

Table 5-4 main.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.CATALOG_CATEGORY

com.beasys.commerce.ebusiness.catalog.Category

Contains the root category for the product catalog.

PipelineSessionConstants
.CATALOG_CATEGORIES

com.beasys.commerce.ebusiness.catalog.ViewIterator

Contains the top-level categories for the product catalog.

Listing 5-6 illustrates how these attributes are obtained from the Pipeline session using the getPipelineProperty Pipeline JSP tag.

Listing 5-6 Obtaining the CATALOG_CATEGORY and CATALOG_CATEGORIES Attributes


<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="topCategory"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORIES%>"
returnName="subcategories"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, a string containing common browse parameters for the page is created, as shown in Listing 5-7. These parameters are used to establish context for the page (that is, a knowledge of previous activity) and provide the Pipelines with appropriate information during their subsequent executions.

Listing 5-7 Creating a String With Common Browse Parameters


<p class="head1">Store Catalog</p>
<ul type="square">

<%-- Declare a String containing common browse parameters --%>

    <%! static final String commonParameters = "&" +
HttpRequestConstants.CATALOG_SOURCE_KEY + "=" +
PipelineSessionConstants.CATALOG_CATEGORIES + "&" +
HttpRequestConstants.CATALOG_DESTINATION_KEY +
"=wlcs_siblings&"; %>


Lastly, the iterateViewIterator Catalog JSP tag is used to iterate through all the categories (one at a time). The context for the page is captured by appending values to the previously established browse parameters, and the getProperty Catalog JSP tag is used to list the name of each category on the main.jsp template.

Listing 5-8 Displaying the Contents of the Product Catalog


    <catalog:iterateViewIterator 
iterator="<%=subcategories%>" id="currentCategory"
returnType="com.beasys.commerce.ebusiness.catalog.Category">

    <% String browseParameters = commonParameters +  
HttpRequestConstants.CATALOG_CATEGORY_ID + "=" +
currentCategory.getKey().getIdentifier(); %>

    <div class="head2">

      <li>

      <a href="<%=WebflowJSPHelper.createWebflowURL(pageContext, 
"main.jsp", "link(browse)", browseParameters, true) %>">

      <catalog:getProperty object="<%=currentCategory%>"
propertyName="Name"/>

      </a><br>

    </div>

    </catalog:iterateViewIterator>

  </ul>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Form Field Specification

No form fields are used in the main.jsp template.

browse.jsp Template

In the hierarchical product catalog, the browse.jsp template can take on two different forms, both of which are used by customers to browse for product items. These forms are as follows:

Figure 5-9 shows a screen shot of this browse.jsp template form, with one included itemsummary.jsp.

Figure 5-9 browse.jsp Template - D > Diggers > Miscellaneous Category With Item Summary Display

Note: Each item in the catalog can be assigned a different item summary JSP, allowing you to customize the layout for each type of item. This assignment can be made on the catalog's administration screen. For more information, see the section How Are Categories and Items Displayed to the Web Site User?.

Sample Browser View

Figure 5-10 shows an annotated version of a browse.jsp template. The dashed lines and numbers in the diagram are not part of the template; they are referenced in the explanation that follows the screen shot.

Figure 5-10 Annotated browse.jsp Template

The numbers in the following list refer to the numbered regions in the figure:

  1. The page header is created from an import of the header.jsp template. This is standard across most of the JSP templates provided by WebLogic Commerce Server. The import call is:

    <%@ include file="/commerce/includes/header.jsp" %>

    The header.jsp file creates the top banner and reserves space for the left-side column. The contents of the column are determined by other processing.

  2. Region 2 of the browse.jsp template contains the quicksearch.jsp template that is included. This template provides a keyword-search feature. The include statement is:

       <%@ include file="/commerce/catalog/includes/quicksearch.jsp" %>

  3. Region 3 of the browse.jsp template contains the results of processing that checks for sibling categories and displays them with hyperlinks to those categories. In this example, the Pack category does not have any sibling categories.

  4. Region 4 of the browse.jsp template includes navigation.jsp, which builds a hierarchical browse list for the catalog's categories from the top-level Home category down to the current category. The call to include this JSP is:

    <jsp:include page="/commerce/catalog/includes/navigation.jsp" flush="true"/>

  5. Regions 5 and 6 of the browse.jsp template shows the generated results of processing with the Webflow and Pipeline mechanisms that found the values for this category (presented in the included category.jsp template). The category.jsp template, in turn, obtains the values that return the item summary data (displayed by the itemsummary.jsp templates) for each product item in this category.

  6. Region 7 of the browse.jsp template contains the included footer.jsp template. The include statement is:

    <%@ include file="/commerce/includes/footer.jsp" %>

    The footer.jsp file consists of the horizontal footer at the bottom of the page (not shown in the figure), plus the right-side vertical column that describes the name of the current template and links to its About information. In the footer.jsp file, the right-side vertical column is an include file:

    <%@ include file="/commerce/includes/rightside.jsp" %> 

Location in the WebLogic Commerce Server Directory Structure

You can find the browse.jsp file at the following location, where WL_COMMERCE_HOME is the directory in which you installed WebLogic Commerce Server:

%WL_COMMERCE_HOME%\server\webapps\wlcs\commerce\catalog\
browse.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/catalog/
browse.jsp
(UNIX)

Tag Library Imports

The browse.jsp template uses Pipeline and Catalog JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="pipeline.tld" prefix="pipeline" %>
<%@ taglib uri="cat.tld" prefix="catalog" %>

Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

These files reside in the following directory for the WebLogic Commerce Server Web application:

%WL_COMMERCE_HOME%\server\webapps\wlcs\WEB-INF (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/WEB-INF (UNIX)

Java Package Imports

The browse.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="com.beasys.commerce.webflow.*" %>
<%@ page import="com.beasys.commerce.foundation.pipeline.*" %>
<%@ page import="com.beasys.commerce.ebusiness.catalog.*" %>

Location in the Default Webflow

The browse.jsp template is displayed (with the included category.jsp template) when a customer clicks on a link for one of the categories shown on the main.jsp template. The browse.jsp template is redisplayed (with different content using the included category.jsp template) each time a customer clicks on a subcategory link. It is also displayed when a customer selects a sibling link from the left-side column. The browse.jsp continues to be displayed until the customer arrives at item summaries (shown by the category.jsp template's included itemsummary.jsp templates). From there, the customer can choose to view more details about an item (which loads the details.jsp template), or add the item to their shopping cart (which loads the shoppingcart.jsp template).

Customers can also still enter keywords and click the Find button to perform a Quick Look-up of a particular product item or category (which loads the searchresults.jsp template). If the customer is logged into the site, the customer can also choose to logout (which loads the generic version of the main.jsp template), view their order history (which loads the orderhistory.jsp template), or view their payment history (which loads the paymenthistory.jsp template).

Note: For more information about the default Webflow, see Figure 5-4.

Included JSP Templates

The following JSP templates are included into the browse.jsp template:

About the Included navigation.jsp Template

The navigation.jsp template (included in the browse.jsp template) is responsible for generating the ancestor category navigation bar that is shown at the top of the page. The navigation.jsp template utilizes Pipeline, Catalog, and the WebLogic Personalization Server's Utility JSP tags to generate this content.

First, the getPipelineProperty Pipeline JSP tag is used to obtain the current category (that is, the CATALOG_CATEGORY attribute) from the Pipeline session, as shown in Listing 5-9.

Listing 5-9 Obtaining the CATALOG_CATEGORY Attribute


<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, the <es> JSP tag (one of the WebLogic Personalization Server Utility JSP tags) is used to ensure that the conditions under which the ancestor category navigation bar is displayed are appropriate. If so, the category's ancestors are obtained from the Pipeline session (again using the getPipelineProperty Pipeline JSP tag).

Listing 5-10 Establishing Conditional Display of the Navigation Bar and Obtaining the Category's Ancestors


<%-- Only output the navigation bar if a current category exists in the PipelineSession --%>

<es:notNull item="<%=category%>">

  <%-- Get the category's ancestors from the PipelineSession --%>

  <pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_ANCESTORS%>"
returnName="ancestors"
returnType="com.beasys.commerce.ebusiness.catalog.Category[]"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information on the WebLogic Personalization Server's Utility JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

Browse parameters for the navigation.jsp template are concatenated into a single string, and a link is created for each category ancestor. These parameters are used to establish context for the page (that is, a knowledge of previous activity) and provide the Pipelines with appropriate information during their subsequent executions. In the case of the last ancestor, a link to the main catalog page is also created. This is accomplished with the <es> WebLogic Personalization Server Utility JSP tag and the getProperty Catalog JSP tag, as shown in Listing 5-11.

Listing 5-11 Generating the Hierarchical Category Navigation Bar


  <%-- Declare a String containing common browse parameters --%>

  <%! static final String commonParameters = "&" +
HttpRequestConstants.CATALOG_SOURCE_KEY + "=" +
PipelineSessionConstants.CATALOG_CATEGORIES + "&" +
HttpRequestConstants.CATALOG_DESTINATION_KEY +
"=wlcs_siblings&"; %>

  <%-- Iterate through all the category's ancestors, creating a
browse link for each --%>

  <es:forEachInArray id="ancestor" 
type="com.beasys.commerce.ebusiness.catalog.Category"
array="<%=ancestors%>" counterId="i">

    <%-- Add a link to the main catalog page in the case of the last
ancestor --%>

      <% if (i.intValue() == 0) { %>
<p><a href="<%= WebflowJSPHelper.createWebflowURL
(pageContext, "navigation.jsp", "link(home)", true)
%>">Home</a>

      <%-- Otherwise, link to the browse page for the current
ancestor --%>

      <% } else { %>
<a href="<%= WebflowJSPHelper.createWebflowURL
(pageContext, "navigation.jsp", "link(browse)",
commonParameters + HttpRequestConstants.CATALOG_CATEGORY_ID
+ "=" + ancestor.getKey().getIdentifier(), true) %>">

	<catalog:getProperty object="<%=ancestor%>"
propertyName="Name"/></a>

      <% } %>

      &nbsp;<b>&gt;</b>

  </es:forEachInArray>

<%-- Insert the category name --%>

  <b><font color="#33632B">
<catalog:getProperty object="<%=category%>"
propertyName="Name"/>
</font></b></p>

</es:notNull>


Note: For more information about the WebLogic Personalization Server's Utility JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

About the Included category.jsp Template

The category.jsp template (included in the browse.jsp template) provides a standardized format for the display of hyperlinked subcategories. In the WebLogic Commerce Server Web application, this format is a simple list. However, you can always modify the template to use a different format.

The category.jsp template utilizes Pipeline and Catalog JSP tags to generate the specialized content displayed in the browse.jsp template. This is accomplished by first obtaining the current catalog category and its subcategories from the Pipeline session using the getPipelineProperty Pipeline JSP tag, as shown in Listing 5-12.

Listing 5-12 Obtaining the CATALOG_CATEGORY and CATALOG_CATEGORIES Attributes


<%-- Get the current category from the PipelineSession --%>

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>

<%-- Get the subcategories from the PipelineSession --%>	

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORIES%>"
returnName="subcategories"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, a string containing common browse parameters for the page is created. These parameters are used to establish context for the page (that is, a knowledge of previous activity) and provide the Pipelines with appropriate information during their subsequent executions. The category.jsp template then displays the current category name using the getProperty Catalog JSP tag, as shown in Listing 5-13.

Listing 5-13 Generating Browse Parameters and Inserting the Category Name


<%! static final String commonParameters = "&" + 
HttpRequestConstants.CATALOG_SOURCE_KEY + "=" +
PipelineSessionConstants.CATALOG_CATEGORIES + "&" +
HttpRequestConstants.CATALOG_DESTINATION_KEY +
"=wlcs_siblings&"; %>

<p class="head1">
<catalog:getProperty object="<%=category%>"propertyName="Name"/>
</p>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Any subcategories associated with the category are then displayed as hyperlinks that allow the customer to browse further. This is done using using the iterateViewIterator Catalog JSP tag, as shown in Listing 5-14.

Listing 5-14 Displaying Hyperlinked Subcategories


<center>
<table cellpadding="3" border="0" width="90%">

  <catalog:iterateViewIterator 
iterator="<%=subcategories%>"
id="subcategory"
returnType="com.beasys.commerce.ebusiness.catalog.Category">

  <tr><td width="30%" valign="top">
<p class="tabletext">
<a href="<%=WebflowJSPHelper.createWebflowURL(pageContext,
"category.jsp", "link(browse)", commonParameters +
HttpRequestConstants.CATALOG_CATEGORY_ID + "=" +
subcategory.getKey().getIdentifier(), true) %>">

    <catalog:getProperty object="<%=subcategory%>"
propertyName="Name"/></a></p>

  </td></tr>

  </catalog:iterateViewIterator>

</table>
</center>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

If there are any individual items at this level in the hierarchy, the category.jsp template retrieves them using the getPipelineProperty Pipeline JSP tag, and sets the view. The view is basically a pointer that indicates the location in the complete list of results where we want to start displaying information. This processing is shown in Listing 5-15.

Listing 5-15 Obtaining Individual Product Items and Setting the View


<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_ITEMS%>"
returnName="items"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>

<% String viewIndexString = (String)request.getParameter(HttpRequestConstants.
CATALOG_VIEW_INDEX); %>

	<% if (viewIndexString == null) { viewIndexString = "0"; } %>

	<% int viewIndex = Integer.valueOf(viewIndexString).intValue(); %>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Lastly, if individual product items were obtained, the category.jsp template iterates through each item using the iterateThroughView and getProperty Catalog JSP tags, and includes an itemsummary.jsp template to display the information related to each item, as shown in Listing 5-16.

Listing 5-16 Iterating Through and Displaying Product Item Information


<catalog:iterateThroughView iterator="<%=items%>" id="item" 
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"
viewIndex="<%= viewIndex %>">

<%-- Add the required parameters for the included JSP to the request --%>

  <% request.setAttribute("product_item", item); %>
<% request.setAttribute("details_link", "details"); %>

<%-- Get the summary JSP from the current product item --%>

  <catalog:getProperty object="<%=item%>" propertyName="Jsp" 
getterArgument="<%= new Integer(ProductItem.SUMMARY_DISPLAY_JSP_INDEX) %>"
id="summaryJsp" returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"/>

		<%-- Included the summary JSP --%>

		  <jsp:include page="<%=summaryJsp.getUrl()%>" flush="true"/>

</catalog:iterateThroughView>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld. For more information about the itemsummary.jsp template, see the following section.

About the Included itemsummary.jsp Template

The itemsummary.jsp template (included in the category.jsp template) provides a standardized format for the display of specific product items. In the WebLogic Commerce Server Web application, this format contains an image, a link to more details about the item (that is, to the details.jsp template), some brief information about the item, and an Add to Cart button. However, you can always modify the template to use a different format.

The itemsummary.jsp template utilizes a combination of Pipeline, Catalog, and the WebLogic Personalization Server's Utility JSP tags to generate the specialized content displayed for each item within the category.jsp template. This is accomplished by first obtaining all required parameters from the request object, and then obtaining the current catalog category (that is, the CATALOG_CATEGORY attribute) from the Pipeline session using the getPipelineProperty Pipeline JSP tag, as shown in Listing 5-17.

Listing 5-17 Obtaining Request Object Parameters and the CATALOG_CATEGORY Attribute


<% ProductItem productItem = 
(ProductItem)request.getAttribute("product_item"); %>

<% String detailsLink = 
(String)request.getAttribute("details_link"); %>

<%-- Get the current category from the PipelineSession --%>

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%=PipelineConstants.REQUEST_SCOPE%>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, each piece of descriptive information for the item is displayed, using the getProperty Catalog JSP tag and the <es> WebLogic Personalization Server Utility JSP tag, as shown in Listing 5-18.

Listing 5-18 Displaying Product Item Information


<%-- Add the small image --%>

<catalog:getProperty object="<%=productItem%>"
propertyName="Image"
getterArgument="<%=new Integer(ProductItem.SMALL_IMAGE_INDEX)%>"
id="smallImage"
returnType="com.beasys.commerce.ebusiness.catalog.ImageInfo"/>

<td valign="top">
<img src="<%=com.beasys.commerce.webflow.WebflowJSPHelper.
createGIFURL(request, response, smallImage.getUrl())%>"
align="left"></td>

<td align="left" valign="top" width="90%">

  <%-- Add the item name and creator --%>
<%-- Create the details link --%>

  <% String detailsUrl = null; %>
<es:isNull item="<%=category%>">

    <% detailsUrl = WebflowJSPHelper.createWebflowURL(pageContext,
"itemsummary.jsp", "link(" + detailsLink + ")", "&" +
HttpRequestConstants.CATALOG_ITEM_SKU + "=" +
productItem.getKey().getIdentifier(), true);%>

  </es:isNull>

  <es:notNull item="<%=category%>">

     <% detailsUrl = WebflowJSPHelper.createWebflowURL(pageContext,
"itemsummary.jsp", "link(" + detailsLink + ")", "&" +
HttpRequestConstants.CATALOG_ITEM_SKU + "=" +
productItem.getKey().getIdentifier() + "&" +
HttpRequestConstants.CATALOG_CATEGORY_ID + "=" +
category.getKey().getIdentifier(), true);%>

  </es:notNull>

  <div class="tabletext"><b>

    <a href="<%=detailsUrl%>">
<catalog:getProperty object="<%=productItem%>"
propertyName="Name"/>
</a>

  </b>,

    <catalog:getProperty object="<%=productItem%>" 
propertyName="Creator"/>

  </div>

  <%-- Add the item price --%>

  <div class="tabletext"><b>

    <catalog:getProperty object="<%=productItem%>"
propertyName="CurrentPrice" id="price"
returnType="com.beasys.commerce.axiom.units.Money"/>

    <%= price.getCurrency() %>
<%= WebflowJSPHelper.priceFormat(price.getValue()) %>

  </b>, Reg.

    <catalog:getProperty object="<%=productItem%>"
propertyName="Msrp" id="msrp"
returnType="com.beasys.commerce.axiom.units.Money"/>

    <%= msrp.getCurrency() %>
<%= WebflowJSPHelper.priceFormat(msrp.getValue()) %>

  </b></div>

<%-- Add inventory information --%>

  <catalog:getProperty object="<%=productItem%>"
propertyName="Availability" id="inventory"
returnType="com.beasys.commerce.ebusiness.catalog.InventoryInfo"
/>

  <div class="tabletext"><b>

    <% if (inventory.getInStock()) { %>
In stock (<%=inventory.getShippingTime()%>)
<% } else { %>
Out of stock.
<% } %>

  </b></div>

<%-- Add a short description of the item --%>

  <hr size="1"><div class="tabletext">

    <catalog:getProperty object="<%=productItem%>"
propertyName="Description"
getterArgument="<%=new Integer
(CatalogItem.SHORT_DESCRIPTION_INDEX)%>"/>

  </div>

<%-- Add the 'Add to Cart' link --%>

  <div align="right">

    <a href="<%=WebflowJSPHelper.createWebflowURL(pageContext, 
"itemsummary.jsp", "link(add)", "&" +
HttpRequestConstants.CATALOG_ITEM_SKU + "=" +
productItem.getKey().getIdentifier(), true) %>">
<img src="<%=com.beasys.commerce.webflow.WebflowJSPHelper.
createGIFURL(request, response, "/commerce/images/
btn_addcart.gif")%>" alt="Add To Shopping Cart" border="0"
vspace="4"></a>

  </div>

</td>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld. For more information about the WebLogic Personalization Server's Utility JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentations.

Events

Every time a customer clicks a link or a button on the browse.jsp template, it is considered an event. Each event triggers a particular response in the default Webflow that allows the customer to continue. While this response can be to load another JSP, it is usually the case that an input processor and/or Pipeline is invoked first. Table 5-5 provides information about these events and the business logic they invoke.

Table 5-5 browse.jsp (and included category.jsp) Events

Event

Webflow Response(s)

link(browse)

BrowseCategory (IP)

MoveSiblingResults (IP)

GetBrowseDetails

Because the category.jsp template also includes the itemsummary.jsp template, the events shown in Table 5-6 are also considered part of the browse.jsp template.

Table 5-6 itemsummary.jsp Events

Event

Webflow Response(s)

link(details)

GetProductItemDetails (IP)

link(add)

AddProductItemToShoppingCart (IP)

Table 5-7 briefly describes each of the Pipelines from Table 5-5, as they are defined in the pipeline.properties file. For more information about individual Pipeline components, see Pipeline Components.

Table 5-7 browse.jsp Pipelines

Pipeline

Description

GetBrowseDetails

Contains GetCategoryPC, GetParentPC, GetSubcategoriesPC, MoveAttributePC, GetCategoryPC, GetAncestorsPC, GetSubcategoriesPC, GetProductItemsPC and is not transactional.

Dynamic Data Display

The primary purpose of the browse.jsp template is to dynamically display content based on the hyperlinked path the customer chooses to follow. As previously described, this is accomplished mostly through the included category.jsp and itemsummary.jsp templates. (For more information, see About the Included category.jsp Template and About the Included itemsummary.jsp Template, respectively.)

However, there is still some dynamic data that is handled solely by the browse.jsp template; that is, the list of sibling categories in the left column. First, the getPipelineProperty Pipeline JSP tag retrieves the CATALOG_CATEGORY and wlcs_siblings attributes from the Pipeline session. Table 5-8 provides more detailed information on these attributes .

Table 5-8 browse.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.CATALOG_CATEGORY

com.beasys.commerce.ebusiness.catalog.Category

Contains the root category for the product catalog.

wlcs_siblings

com.beasys.commerce.ebusiness.catalog.ViewIterator

Contains the siblings for a given category.

Listing 5-19 illustrates how these attributes are retrieved from the Pipeline session using the getPipelineProperty Pipeline JSP tag, along with the category siblings.

Listing 5-19 Obtaining the CATALOG_CATEGORY and wlcs_siblings Attributes


<!-- sibling categories (or subcategories) with the current category highlighted to indicate state -->

<%-- Get the current category from the PipelineSession --%>

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>

<%-- Get the siblings from the PipelineSession --%>

<pipeline:getPipelineProperty 
propertyName="wlcs_siblings"
returnName="siblings"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, a string containing common browse parameters for the page is created. These parameters are used to establish context for the page (that is, a knowledge of previous activity) and provide the Pipelines with appropriate information during their subsequent executions. The iterateViewIterator and getProperty Catalog JSP tags are then used to iterate through the siblings and create browse hyperlinks for each of them (if appropriate), as shown in Listing 5-20. This activity happens prior to any calls to the included category.jsp and/or itemsummary.jsp templates.

Listing 5-20 Establishing Common Browse Parameters and Creating Browse Links for Categories


<%-- Declare a String containing common browse parameters --%>

<%! static final String commonParameters = "&" +
HttpRequestConstants.CATALOG_SOURCE_KEY + "=" + PipelineSessionConstants.CATALOG_CATEGORIES + "&" +
HttpRequestConstants.CATALOG_DESTINATION_KEY + "=wlcs_siblings&"; %>

<%-- Iterate through all siblings, creating a browse link for each. --%>

<p>&nbsp;</p>

<catalog:iterateViewIterator iterator="<%=siblings%>" id="sibling" 
returnType="com.beasys.commerce.ebusiness.catalog.Category">

<%-- Just highlight the category name if the current sibling is the current category --%>

<% if (sibling.getKey().equals(category.getKey())) { %>
<p><b><font color="#33632B">
<catalog:getProperty object="<%=sibling%>" propertyName="Name"/>
</font></b></p>

<% } else { %>

<%-- Otherwise, link to the browse page for the current sibling --%>

  <p><a href="<%=WebflowJSPHelper.createWebflowURL(pageContext,
"browse.jsp", "link(browse)", commonParameters +
HttpRequestConstants.CATALOG_CATEGORY_ID + "=" +
sibling.getKey().getIdentifier(), true) %>">

  <catalog:getProperty object="<%=sibling%>" 
propertyName="Name"/></a></p>

<% } %>

</catalog:iterateViewIterator>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Form Field Specification

No form fields are used in the browse.jsp template, nor in the browse.jsp template's included category.jsp or itemsummary.jsp templates.

details.jsp Template

The brief description presented for each product item on the generated itemsummary.jsp templates includes a hyperlink to the item. When customers click this link, the browser loads the details.jsp template, which customer can use to view more detailed information about the item. Although the WebLogic Commerce Server Web application presents the same information on the itemsummary.jsp template and the details.jsp template, you can use this page separation to customize the content for your customers.

Because the name of the detailed display JSP is loaded from the database (that is, it does not have to always be details.jsp), you can have different display JSPs for different product catalog items. For example, you can provide custom display JSPs to include seasonal or promotional text. The product catalog administrator simply needs to switch between the detailed display JSPs (once they have been tested) using the Administration Tools.

Notes: For more information about the itemsummary.jsp template, see About the Included itemsummary.jsp Template.

For more information about the product catalog Administration Tools, see Catalog Administration Tasks.

Sample Browser View

Figure 5-11 shows an annotated version of a details.jsp template. The dashed lines and numbers in the diagram are not part of the template; they are referenced in the explanation that follows the screen shot.

Figure 5-11 Annotated details.jsp Template

The numbers in the following list refer to the numbered regions in the figure:

  1. The page header (top banner) is created from an import of the header2.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

<%@ include file="/commerce/includes/header2.jsp" %>

  1. Region 2 of the details.jsp template includes navigation.jsp, which builds a hierarchical browse list for the catalog's categories from the top-level Home category down to the current category. The call to include this JSP is:

    <jsp:include page="/commerce/catalog/includes/navigation.jsp" flush="true"/>

  2. Region 3 of the details.jsp template shows the results generated from processing with the Webflow and Pipeline mechanisms that found the detailed information for this particular product item (presented in the included itemdetails.jsp template).

  3. Region 4 of the details.jsp template contains the included footer2.jsp template. The include statement is:

    <%@ include file="/commerce/includes/footer2.jsp" %>

    The footer2.jsp file consists of the horizontal footer at the bottom of the page, plus the right-side vertical column that describes (for the benefit of you and your development team) the name of the current template and links to its About information. In the footer2.jsp file, the right-side vertical column is an include file:

    <%@ include file="/commerce/includes/rightside.jsp" %> 

Location in the WebLogic Commerce Server Directory Structure

You can find the details.jsp file at the following location, where WL_COMMERCE_HOME is the directory in which you installed WebLogic Commerce Server:

%WL_COMMERCE_HOME%\server\webapps\wlcs\commerce\catalog\
details.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/catalog/
details.jsp
(UNIX)

Tag Library Imports

The details.jsp template uses Pipeline and Catalog JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="pipeline.tld" prefix="pipeline" %>
<%@ taglib uri="cat.tld" prefix="catalog" %>

Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

These files reside in the following directory for the WebLogic Commerce Server Web application:

%WL_COMMERCE_HOME%\server\webapps\wlcs\WEB-INF (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/WEB-INF (UNIX)

Java Package Imports

The details.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="com.beasys.commerce.webflow.*" %>
<%@ page import="com.beasys.commerce.foundation.pipeline.*" %>
<%@ page import="com.beasys.commerce.ebusiness.catalog.*" %>

Location in the Default Webflow

The details.jsp template is displayed when a customer clicks on a link for a particular product item shown on an itemsummary.jsp template (part of the browse.jsp or search.jsp templates). From the details.jsp template, the customer can choose to browse back up the ancestor category navigation bar (which loads the browse.jsp template) or add the product item to their shopping cart (which loads the shoppingcart.jsp template).

Note: For more information about the default Webflow, see Figure 5-4.

Included JSP Templates

The following JSP templates are included into the details.jsp template:

About the Included itemdetails.jsp Template

The itemdetails.jsp template (included in the details.jsp template) provides a standardized format for the display of specific item information. In the WebLogic Commerce Server Web application, this format is the same as what is shown in the itemsummary.jsp templates, with some exceptions. In the itemdetails.jsp template, for example, there is a link to a larger version of the image, and no link to the product item itself. (For more information about itemsummary.jsp templates, see About the Included itemsummary.jsp Template.) Remember, you can always modify the template to use a different format that better suits your requirements.

Events

Every time a customer clicks a link or button on a JSP, it is considered an event. Events trigger particular responses in the default Webflow that allow customers to continue. While this response can be to load another JSP, it is usually the case that an input processor and/or Pipeline is invoked first.

Because the details.jsp template includes the itemdetails.jsp template (which is used to display most of the information), Table 5-9 provides information about the only event for the included item details.jsp template, and the business logic it invokes.

Table 5-9 itemdetails.jsp Events

Event

Webflow Response(s)

link(add)

AddProductItemToShoppingCart (IP)

AddProductItemToShoppingCart

RefreshSavedList

Table 5-10 briefly describes each of the Pipelines from Table 5-9, as they are defined in the pipeline.properties file. For more information about individual Pipeline components, see Pipeline Components.

Table 5-10 itemdetails.jsp Pipelines

Pipeline

Description

AddProductItemToShoppingCart

Contains GetProductItemPC and AddProductItemToShoppingCartPC, and is not transactional.

RefreshSavedList

Contains RefreshSavedListPC and is not transactional.

Dynamic Data Display

The primary purpose of the details.jsp template is to dynamically display content about a customer-selected the product item. As previously described, this is accomplished mostly through the included itemdetails.jsp template. (For more information, see About the Included itemdetails.jsp Template.)

However, there is still some dynamic data that is handled solely by the details.jsp template. After an include to navigation2.jsp (which generates the ancestor category navigation bar at the top of the page), the details.jsp template obtains the CATALOG_ITEM and CATALOG_CATEGORY attributes from the Pipeline session. Table 5-11 provides more detailed information on these attributes .

Table 5-11 details.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.CATALOG_CATEGORY

com.beasys.commerce.ebusiness.catalog.Category

Contains the root category for the product catalog.

PipelineSessionConstants
.CATALOG_CATEGORIES

com.beasys.commerce.ebusiness.catalog.ViewIterator

Contains the top-level categories for the product catalog.

Listing 5-21 illustrates how these attributes are obtained from the Pipeline session using the getPipelineProperty Pipeline JSP tag. It also shows how the required request parameters for the included JSP are added to the request. This activity happens prior to any calls to the included itemdetails.jsp template.

Listing 5-21 Obtaining the CATALOG_CATEGORY and CATALOG_CATEGORIES Attributes


<%-- Get the item from the PipelineSession --%>

<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_ITEM%>"
returnName="item"
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>

	<%-- Get the category from the PipelineSession --%>

	<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_CATEGORY%>"
returnName="category"
returnType="com.beasys.commerce.ebusiness.catalog.Category"
attributeScope="<%= PipelineConstants.REQUEST_SCOPE %>"/>

	<%-- Add the required parameters for the included JSP to the request --%>

	<% request.setAttribute("product_item", item); %>
<% request.setAttribute("category", category); %>

<%-- Get the summary JSP from the current product item --%>

<catalog:getProperty object="<%=item%>" 
propertyName="Jsp"
getterArgument="<%=new Integer(ProductItem.DETAILED_DISPLAY_JSP_INDEX)%>"
id="detailJsp"
returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"/>


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Form Field Specification

No form fields are used in the details.jsp template, nor in the details.jsp template's included itemdetails.jsp template.

search.jsp

The search.jsp template displays a form field that allows users to perform advanced searches on the product catalog. Searches are performed using Boolean expressions; results are displayed below the search area, using included summary JSPs.

Notes: It is not expected that end-users will search a product catalog using a free form, text-based query syntax. The free form syntax input field is provided to illustrate the power of the search functionality. You should customize the search.jsp template to include drop-down lists with the attributes that are appropriate for your business or product items. For example, companies selling books might have edit fields that corresponed to Author Name, ISBN, Price, and so on. The contents of these fields would then be converted into a search expression and passed to the catalog system for processing.

For more information about using the search.jsp to perform searches and a description of the syntax for a search expression, refer to Query-based Search Syntax.

Sample Browser View

Figure 5-12 shows an annotated version of the search.jsp template. The dashed lines and numbers in the diagram are not part of the template; they are referenced in the explanation that follows the screen shot.

Figure 5-12 Annotated search.jsp Template

The numbers in the following list refer to the numbered regions in the figure:

  1. The page header (top banner) is created from an import of the header2.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

<%@ include file="/commerce/includes/header2.jsp" %>

  1. Region 2 of the search.jsp template is the search area. It provides examples of searches using Boolean expressions, and provides the form field in which customers can enter their search criteria. Following the execution of a search, this region also includes a search results section, as shown in Figure 5-13.

    Figure 5-13 The search.jsp Template With Search Results

  2. Region 3 of search.jsp contains the included footer2.jsp template. The include call statement is:

    <%@ include file="/commerce/includes/footer2.jsp" %>

    The footer2.jsp file consists of the horizontal footer at the bottom of the page, plus the right-side vertical column that describes (for the benefit of you and your development team) the name of the current template and links to its About information. In the footer2.jsp file, the right-side vertical column is an include file:

    <%@ include file="/commerce/includes/rightside.jsp" %> 

Location in the WebLogic Commerce Server Directory Structure

You can find the search.jsp file at the following location, where WL_COMMERCE_HOME is the directory in which you installed WebLogic Commerce Server:

%WL_COMMERCE_HOME%\server\webapps\wlcs\commerce\catalog\
search.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/catalog/
search.jsp
(UNIX)

Tag Library Imports

The search.jsp template uses Pipeline, Catalog, and WebLogic Server JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="pipeline.tld" prefix="pipeline" %>
<%@ taglib uri="cat.tld" prefix="catalog" %>
<%@ taglib uri="weblogic.tld" prefix="wl" %>

Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld. For more information on the WebLogic Server JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

These files reside in the following directory for the WebLogic Commerce Server Web application:

%WL_COMMERCE_HOME%\server\webapps\wlcs\WEB-INF (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/WEB-INF (UNIX)

Java Package Imports

The search.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="com.beasys.commerce.webflow.*" %>
<%@ page import="com.beasys.commerce.foundation.pipeline.*" %>
<%@ page import="com.beasys.commerce.ebusiness.catalog.*" %>

Location in the Default Webflow

The search.jsp template is displayed any time a customer clicks the Search button located in the top banner of most pages. When a Boolean search is submitted, the search.jsp template is reloaded (with included itemsummary.jsp templates for each resulting item). From any of the included itemsummary.jsp templates, customers can view details about the item (which loads the details.jsp template) or add the item to their shopping cart (which loads the shoppingcart.jsp template). Because search results are viewed in groups of 10 by default, the customer may also be able to click Previous/Next links that reload the search.jsp template with new content.

Note: For more information about the default Webflow, see Figure 5-4.

Included JSP Templates

The following JSP templates are included into the search.jsp template:

Events

Every time a customer clicks a link or button on a JSP, it is considered an event. Events trigger particular responses in the default Webflow that allow customers to continue. While this response can be to load another JSP, it is usually the case that an input processor and/or Pipeline is invoked first. Table 5-12 provides information about the events for the search.jsp template, and the business logic they invoke.

Table 5-12 search.jsp Events

Event

Webflow Response(s)

--

NewSearch (IP)

NewSearch

link(search)

ExpressionSearch (IP)

ExpressionSearch

Note: The NewSearch input processor and Pipeline are not triggered by an event on the search.jsp template. Rather, they are executed when customers click the Search button in the top banner. These mechanisms reset the search results prior to display of the search.jsp template.

Because the search.jsp template also includes the itemsummary.jsp template, the events shown in Table 5-13 are also considered part of the search.jsp template.

Table 5-13 itemsummary.jsp Events

Event

Webflow Response(s)

link(details)

GetProductItemDetails (IP)

link(add)

AddProductItemToShoppingCart (IP)

Table 5-14 briefly describes each of the Pipelines from Table 5-12, as they are defined in the pipeline.properties file. For more information about individual Pipeline components, see Pipeline Components.

Table 5-14 search.jsp Pipelines

Pipeline

Description

NewSearch

Contains RemoveAttributePC and is not transactional.

ExpressionSearch

Contains SearchPC and is not transactional.

Dynamic Data Display

One purpose of the search.jsp template is to present customers with information about the product items that resulted from their search, which customers can then browse. This is accomplished using a combination of Pipeline and Catalog JSP tags.

First, the getPipelineProperty Pipeline JSP tag is used to obtain the CATALOG_SEARCH_RESULTS attribute from the Pipeline session. Table 5-15 provides more detailed information on this attribute.

Table 5-15 search.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.CATALOG_SEARCH_RESULTS

com.beasys.commerce.ebusiness.catalog.ViewIterator

Contains the results of the customer's search.

Listing 5-22 illustrates how this attribute is obtained from the Pipeline session using the getPipelineProperty Pipeline JSP tag.

Listing 5-22 Obtaining the CATALOG_SEARCH_RESULTS Attribute


<pipeline:getPipelineProperty 
propertyName="<%=PipelineSessionConstants.CATALOG_SEARCH_RESULTS%>"
returnName="results"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator" />


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Then, the search.jsp template sets the view. The view is basically a pointer that indicates the location in the complete list of results where we want to start displaying information. This processing is shown in Listing 5-23.

Listing 5-23 Setting the View of the Search Results


<% if (results != null && results.size() > 0) { %>
<% String viewIndexString =
(String)request.getParameter(HttpRequestConstants.CATALOG_VIEW_INDEX); %>

   		<% if (viewIndexString == null) { viewIndexString = "0"; } %>
<% int viewIndex = Math.min(Integer.valueOf(viewIndexString).intValue(),
results.getViewCount() - 1); %>
<% results.gotoViewAt(viewIndex); %>


Next, if the search results require more than one view, a navigation bar (containing Previous and Next links, as well as text showing the results currently being viewed) is generated, as shown in Listing 5-24.

Listing 5-24 Generating the View Navigation Bar


<table border="0" width="90%">
<tr>

<td align="left" valign="top"><p class="head2">Results of your search</p>			</td>

			<td align="right" valign="bottom">
<p class="tabletext"> <b>

			  <%-- Add previous link --%>

  			<% if (results.hasPreviousView()) { %>
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext, "search.jsp",
"link(search)", "&" + HttpRequestConstants.CATALOG_VIEW_INDEX + "=" +
(viewIndex - 1), true) %>">Previous</a> |
<% } %>

  			<%-- Add current view indicies --%>

  			<% if (results.size() > 1) { %>
<%= results.getCurrentView().getFirstIndex() %> - <%= results.
getCurrentView().getLastIndex() %>
<% } %>

			  <%-- Add next link --%>

  			<% if (results.hasNextView()) { %>
| <a href="<%= WebflowJSPHelper.createWebflowURL(pageContext, "search.jsp",
"link(search)", "&" + HttpRequestConstants.CATALOG_VIEW_INDEX + "=" +
(viewIndex + 1), true) %>">Next</a>
<% } %>

			</b>

			</td>

		</tr>
</table>


Lastly, the iterateThroughView Catalog JSP tag is used to iterate through the product items that are in the current view. The required parameters for the included JSP are added to the request, and the getProperty Catalog JSP tag obtains the correct itemsummary.jsp templates for inclusion into the search.jsp template. This processing is shown in Listing 5-25.

Listing 5-25 Obtaining and Displaying the Product Item Summaries


<%-- Iterate through the items in the current view, including the summary JSP for each --%>

		<catalog:iterateThroughView iterator="<%=results%>" id="item" 
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"
viewIndex="<%= viewIndex %>">

   			<%-- Add the required parameters for the included JSP to the request --%>

   			<% request.setAttribute("product_item", item); %>
<% request.setAttribute("details_link", "itemdetails"); %>

   			<%-- Get the summary JSP from the current product item --%>

   			<catalog:getProperty object="<%=item%>" 				propertyName="Jsp"
getterArgument="<%= new Integer(ProductItem.SUMMARY_DISPLAY_JSP_INDEX) %>"
id="summaryJsp"
returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"/>

   			<%-- Included the summary JSP --%>

   			<jsp:include page="<%= summaryJsp.getUrl() %>" flush="true"/>

		</catalog:iterateThroughView>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Form Field Specification

The primary purpose of the search.jsp template is to allow customers to enter their search criteria into an HTML form field. It is also used to pass needed information to the Webflow.

The form fields used in the search.jsp template, and a description for each of these form fields are listed in Table 5-16.

Table 5-16 search.jsp Form Fields

Parameter Name

Type

Description

HttpRequestConstants.
CATALOG_VIEW_SIZE

Hidden

Optional parameter that allows you to specify the number of items shown in a result view.

HttpRequestConstants.
CATALOG_SEARCH_STRING

Text

The form field into which customers will enter their search criteria.

HttpRequestConstants.
CATALOG_SOURCE_KEY

Hidden

Used to determine whether results are from a new search or an iteration through an existing search.

Note: Parameters that are literals in the JSP code are shown in quotes, while non-literals will require scriptlet syntax (such as
<%= HttpRequestConstants.CATALOG_VIEW_SIZE %>) for use in the JSP.

searchresults.jsp

The searchresults.jsp template displays results from a keyword search that is launched from the Quick Look-up text field. The Quick Look-up is available in the left-side column of any page on the site.

Sample Browser View

Figure 5-14 shows an annotated version of the searchresults.jsp template. The dashed lines and numbers in the diagram are not part of the template; they are referenced in the explanation that follows the screen shot.

Figure 5-14 Annotated searchresults.jsp Template

The numbers in the following list refer to the numbered regions in the figure:

  1. The page header (top banner) is created from an import of the header.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

<%@ include file="/commerce/includes/header.jsp" %>

  1. Region 2 of the searchresults.jsp template contains the quicksearch.jsp template that is included. This template provides a keyword-search feature. The include statement is:

       <%@ include file="/commerce/catalog/includes/quicksearch.jsp" %>

  2. Region 3 provides customers with a link back to the home page (that is, the main.jsp template) and some information about how many matches to their search criteria were identified. Both are presented in a format that is similar to the ancestor category navigation bar that appears on the browse.jsp template.

    Note: For more information about the browse.jsp template, see browse.jsp Template.

  3. Region 4 of the searchresults.jsp template shows the results generated from processing with the Webflow and Pipeline mechanisms that found the detailed information for each resulting product item (presented in the included itemsummary.jsp template).

  4. Region 5 of the searchresults.jsp template contains the included footer.jsp template. The include statement is:

    <%@ include file="/commerce/includes/footer.jsp" %>

    The footer.jsp file consists of the horizontal footer at the bottom of the page, plus the right-side vertical column that describes (for the benefit of you and your development team) the name of the current template and links to its About information. In the footer.jsp file, the right-side vertical column is an include file:

    <%@ include file="/commerce/includes/rightside.jsp" %>

Location in the WebLogic Commerce Server Directory Structure

You can find the searchresults.jsp file at the following location, where WL_COMMERCE_HOME is the directory in which you installed WebLogic Commerce Server:

%WL_COMMERCE_HOME%\server\webapps\wlcs\commerce\catalog\
searchresults.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/catalog/
searchresults.jsp
(UNIX)

Tag Library Imports

The searchresults.jsp template uses Pipeline, Catalog, and the WebLogic Personalization Server Utility JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="pipeline.tld" prefix="pipeline" %>
<%@ taglib uri="cat.tld" prefix="catalog" %>
<%@ taglib uri="es.tld" prefix="es" %>

Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld. For more information on the WebLogic Personalization Server Utility JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

These files reside in the following directory for the WebLogic Commerce Server Web application:

%WL_COMMERCE_HOME%\server\webapps\wlcs\WEB-INF (Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/WEB-INF (UNIX)

Java Package Imports

The searchresults.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="com.beasys.commerce.webflow.*" %>
<%@ page import="com.beasys.commerce.foundation.pipeline.*" %>
<%@ page import="com.beasys.commerce.ebusiness.catalog.*" %>

Location in the Default Webflow

Customers arrive at the searchresults.jsp template after they enter a keyword in the Quick Look-up text field (located in the left-side column of every page) and click the Find button. From here, customers can navigate back to the main.jsp template using the Home link at the top of the page. Customers can also choose to view more details about a particular item shown in the results list (which loads the details.jsp template), or add the product item to their shopping cart (which loads the shoppingcart.jsp template). Finally, customers can also choose to perform another search by using the Quick Look-up again.

Note: For more information about the default Webflow, see Figure 5-4.

Included JSP Templates

The following JSP templates are included into the searchresults.jsp template:

Events

Every time a customer clicks a link or button on a JSP, it is considered an event. Events trigger particular responses in the default Webflow that allow customers to continue. While this response can be to load another JSP, it is usually the case that an input processor and/or Pipeline is invoked first. Table 5-17 provides information about the events for the searchresults.jsp template, and the business logic they invoke.

Table 5-17 searchresults.jsp Events

Event

Webflow Response(s)

link(home)

GetTopCategories (IP)

GetTopCategories

link(quicksearch)

KeywordSearch (IP)

KeywordSearch

Because the searchresults.jsp template also includes the itemsummary.jsp template, the events shown in Table 5-18 are also considered part of the search.jsp template.

Table 5-18 itemsummary.jsp Events

Event

Webflow Response(s)

link(details)

GetProductItemDetails (IP)

link(add)

AddProductItemToShoppingCart (IP)

Table 5-19 briefly describes each of the Pipelines from Table 5-17, as they are defined in the pipeline.properties file. For more information about individual Pipeline components, see Pipeline Components.

Table 5-19 search.jsp Pipelines

Pipeline

Description

GetTopCategories

Contains GetCategoryPC and GetSubcategoriesPC and is not transactional.

KeywordSearch

Contains SearchPC and is not transactional.

Dynamic Data Display

The primary purpose of the searchresults.jsp template is to present customers with information about the product items that resulted from their search, which customers can then browse through. This is accomplished using a combination of Pipeline and Catalog JSP tags.

First, the getPipelineProperty Pipeline JSP tag is used to obtain the CATALOG_QUERY and CATALOG_SEARCH_RESULTS attributes from the Pipeline session. Table 5-20 provides more detailed information on these attributes.

Table 5-20 searchresults.jsp Pipeline Session Attributes

Attribute

Type

Description

PipelineSessionConstants.CATALOG_QUERY

com.beasys.commerce.ebusiness.catalog.service.query.
KeywordQuery

Contains the customer's search criteria.

PipelineSessionConstants.CATALOG_SEARCH_RESULTS

com.beasys.commerce.ebusiness.catalog.ViewIterator

Contains the results of the customer's search.

Listing 5-26 illustrates how this attribute is obtained from the Pipeline session using the getPipelineProperty Pipeline JSP tag.

Listing 5-26 Obtaining the CATALOG_QUERY and CATALOG_SEARCH_RESULTS Attributes


<pipeline:getPipelineProperty 
propertyName="<%= PipelineSessionConstants.CATALOG_QUERY %>"
returnName="query"
returnType="com.beasys.commerce.ebusiness.catalog.service.query.KeywordQuery"/>

<pipeline:getPipelineProperty 
propertyName="<%= PipelineSessionConstants.CATALOG_SEARCH_RESULTS %>"
returnName="results"
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator" />


Note: For more information on the Pipeline JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

Next, the navigation bar at the top of the page (containing the Home link and number of matches) is constructed using the <es> WebLogic Personalization Server Utility JSP tag, as shown in Listing 5-27.

Listing 5-27 Constructing the Top Navigation Bar


<p>
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext,
"searchresults.jsp", "link(home)", true) %>">Home</a>

&nbsp;<b>&gt;</b>

<b>
<font color="#9C77DE">Result of search for "

  <es:forEachInArray id="keyword" type="java.lang.String" 
array="<%= query.getKeywords() %>">
<%= " " + keyword %>
</es:forEachInArray>"
- <%= results.size() %> match<% if (results.size() > 1 ||
results.size() == 0) { %>es<% } %>

</font>
/b>

</p>

<hr size="1" width="90%" align="left">


Note: For more information on the WebLogic Personalization Server Utility JSP tags, see "JSP Tag Reference" in the BEA WebLogic Personalization Server documentation.

Then, the searchresults.jsp template sets the view. The view is basically a pointer that indicates the location in the complete list of results where we want to start displaying information. This processing is shown in Listing 5-28.

Listing 5-28 Setting the View of the Search Results


<% if (results != null && results.size() > 0) { %>
<% String viewIndexString =
(String)request.getParameter(HttpRequestConstants.CATALOG_VIEW_INDEX); %>

   		<% if (viewIndexString == null) { viewIndexString = "0"; } %>
<% int viewIndex = Math.min(Integer.valueOf(viewIndexString).intValue(),
results.getViewCount() - 1); %>
<% results.gotoViewAt(viewIndex); %>


Next, if the search results require more than one view, a navigation bar (containing Previous and Next links, as well as text showing the results currently being viewed) is generated, as shown in Listing 5-29.

Listing 5-29 Generating the View Navigation Bar


<table border="0" width="90%">
<tr>

<td align="left" valign="top"><p class="head2">Results of your search</p>			</td>

			<td align="right" valign="bottom">
<p class="tabletext"> <b>

			  <%-- Add previous link --%>

  			<% if (results.hasPreviousView()) { %>
<a href="<%= WebflowJSPHelper.createWebflowURL(pageContext, "search.jsp",
"link(search)", "&" + HttpRequestConstants.CATALOG_VIEW_INDEX + "=" +
(viewIndex - 1), true) %>">Previous</a> |
<% } %>

  			<%-- Add current view indicies --%>

  			<% if (results.size() > 1) { %>
<%= results.getCurrentView().getFirstIndex() %> - <%= results.
getCurrentView().getLastIndex() %>
<% } %>

			  <%-- Add next link --%>

  			<% if (results.hasNextView()) { %>
| <a href="<%= WebflowJSPHelper.createWebflowURL(pageContext, "search.jsp",
"link(search)", "&" + HttpRequestConstants.CATALOG_VIEW_INDEX + "=" +
(viewIndex + 1), true) %>">Next</a>
<% } %>

			</b>

			</td>

		</tr>
</table>


Lastly, the iterateThroughView Catalog JSP tag is used to iterate through the product items that are in the current view. The required parameters for the included JSP are added to the request, and the getProperty Catalog JSP tag obtains the correct itemsummary.jsp templates for inclusion into the searchresults.jsp template. This processing is shown in Listing 5-30.

Listing 5-30 Obtaining and Displaying the Product Item Summaries


<%-- Iterate through the items in the current view, including the summary JSP for each --%>

		<catalog:iterateThroughView iterator="<%=results%>" id="item" 
returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"
viewIndex="<%= viewIndex %>">

   			<%-- Add the required parameters for the included JSP to the request --%>

   			<% request.setAttribute("product_item", item); %>
<% request.setAttribute("details_link", "itemdetails"); %>

   			<%-- Get the summary JSP from the current product item --%>

   			<catalog:getProperty object="<%=item%>" 				propertyName="Jsp"
getterArgument="<%= new Integer(ProductItem.SUMMARY_DISPLAY_JSP_INDEX) %>"
id="summaryJsp"
returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"/>

   			<%-- Included the summary JSP --%>

   			<jsp:include page="<%= summaryJsp.getUrl() %>" flush="true"/>

		</catalog:iterateThroughView>


Note: For more information about the Catalog JSP tags, see The Catalog JSP Tag Library: cat.tld.

Form Field Specification

No form fields are used in the searchresults.jsp template.

 


Query-based Search Syntax

Search queries within the BEA WebLogic Commerce Server product use a syntax similar to the SQL string syntax that supports basic Boolean-type comparison expressions, including nested parenthetical queries. In general, the syntax includes a metadata property name, a comparison operator, and a literal value.

The basic query uses the following syntax:

attribute_name comparison_operator literal_value

Note: Consult the Javadoc API documentation on com.beasys.commerce.util.ExpressionHelper for more information about the query syntax.

Several constraints apply to queries constructed using this syntax:

The following examples illustrate full expressions:

Example 1:

((color=`red' && size <=1024) || (keywords contains `red' && creationDate < now))

Example 2:

creationDate > toDate (`MM/dd/yyyy HH:mm:ss', `2/22/2000 14:51:00') && expireDate <= now && mimetype like `text/*'

Using Comparison Operators to Construct Queries

To support advanced searching, the system allows construction of nested Boolean queries incorporating comparison operators. The following table summarizes the comparison operators available for each metadata type.

Operator Type

Characteristics

Boolean (==, !=)

Boolean attributes support an equality check against Boolean.TRUE or Boolean.FALSE.

Numeric (==, !=, >, <, >=, <=)

Numeric attributes support the standard equality, greater than, and less than checks against a java.lang.Number.

Text (==, !=, >, <, >=, <=, like)

Text strings support standard equality checking (case sensitive), plus lexicographical comparison (less than or greater than). In addition, strings can be compared using wildcard pattern matching (that is, the like operator), similar to the SQL LIKE operator or DOS prompt file matching. In this situation, the wildcards will be * (asterisk) for match any and ? (question mark) for match single. Interval matching (for example, using [ ]) is not supported. To match * or ? exactly, the quote character will be \ (backslash).

Datetime (==, !=, >, <, >=, <=)

Date/time attributes support standard equality, greater than, and less than checks against a java.sql.Timestamp.

Multi-valued Comparison Operators (contains, containsall)

Multi-valued attributes support a contains operator that takes an object of the attribute's subtype and checks that the attribute's value contains it. Additionally, multi-valued attributes support a containsall operator, which takes another collection of objects of the attribute's subtype and checks that the attribute's value contains all of them.

Single-valued operators applied to a multi-valued attribute should cause the operator to be applied over the attribute's collection of values. Any value that matches the operator and operand should return true. For example, if the multi-valued text attribute keywords has the values BEA, Computer, and WebLogic and the operand is BEA, then the < operator returns true (BEA is less than Computer), the > operator returns false (BEA is not greater than any of the values), and the == operator returns true (BEA is equal to BEA).

User Defined Comparison Operators

Currently, no operators can be applied to a user-defined attribute.

Note: The search parameters and expression objects support negation (using !) of expressions via a bit flag.

Searchable Catalog Attributes

You can base your searches on the following attributes of the product catalog:

Controlling the Number of Search Results

The number of items returned from a keyword- or attribute-based search is controlled using the following APIs:

These are methods on the com.beasys.commerce.ebusiness.catalog.service.query.KeywordQuery and ProductItemQuery interfaces.

If an unlimited number of search results is desired, use:

setMaxSearchResults( CatalogQuery.ALL_RESULTS );

Limiting the number of search results returned prevents potentially very large result sets from being moved from the database to the JSP container. If the search query name like '*' is executed, all the items in the database will be returned. It may be desirable to limit the size of the result set to a suitably large number such as 1,000.

By default, the results from queries are not limited. As shown in Listing 5-31, the default search result size is controlled by the catalog.searchresults.size property in the wlcs-catalog.properties file. The file resides in the WL_COMMERCE_HOME\classes directory, where WL_COMMERCE_HOME is the directory in which you installed the WebLogic Commerce Server software.

Listing 5-31 Using the wlcs-catalog.properties File to Control the Default Search Result Size


###############################################################################
# Maximum search results returned by the catalog
#
# You can dynamically change the searchresults by using the
# get/set MaxSearchResults methods on the CatalogQuery object
#
# Set the value to -1 to return all results by the search engine
###############################################################################
catalog.searchresults.size=-1


 


Input Processors

This section provides a brief description of each input processor associated with the Product Catalog JSP templates.

CatalogIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
CatalogIP

Description

Base InputProcessor for all Catalog-related InputProcessors. This abstract class contains global Catalog HTTP request parameter extraction and validation.

Required HTTPServletRequest
Parameters

None

Optional
HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_VIEW_SIZE

Required Pipeline Session Attributes

None

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_VIEW_SIZE (Request scope) only if CATALOG_VIEW_SIZE is given in the HTTPServletRequest.

Removed Pipeline Session Attributes

None

Validation

Verifies that the CATALOG_VIEW_SIZE parameter is specified appropriately. Because view size is an optional parameter, no action is taken if it is not specified.

Exceptions

ProcessingException, thrown if the CATALOG_VIEW_SIZE is invalid.

GetProductItemIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
GetProductItemIP

Description

Creates a ProductItemKey based on a product item SKU HTTP request parameter and adds it to the Pipeline session.

Required HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_ITEM_SKU

Optional HTTPServletRequest
Parameters

None

Required Pipeline Session Attributes

None

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_ITEM_KEY (Request scope)

Removed Pipeline Session Attributes

None

Validation

Verifies that the CATALOG_ITEM_SKU parameter is valid.

Exceptions

ProcessingException, thrown if the CATALOG_ITEM_SKU parameter is invalid.

GetCategoryIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
GetCategoryIP

Description

Creates a CategoryKey based on a category ID HTTP request parameter and adds it to the Pipeline session. If no such parameter is supplied, the CategoryKey for the root category is added.

Required HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_CATEGORY_ID

Optional HTTPServletRequest
Parameters

None

Required Pipeline Session Attributes

None

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY_KEY (Request scope)

Removed Pipeline Session Attributes

None

Validation

Validates that the CATALOG_CATEGORY_ID parameter is valid.

Exceptions

ProcessingException, thrown if the CATALOG_CATEGORY_ID parameter is invalid.

KeywordSearchIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
KeywordSearchIP

Description

Creates a KeywordQuery based on a keyword search HTTP request parameter and adds it to the Pipeline session.

Required HTTPServletRequest
Parameters

None

Optional HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_SEARCH_STRING

Required Pipeline Session Attributes

PipelineSessionConstants.CATALOG_QUERY. Required only if the CATALOG_SEARCH_STRING parameter does not exist.

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_QUERY

Removed Pipeline Session Attributes

PipelineSessionConstants.CATALOG_SEARCH_RESULTS, only if the CATALOG_SEARCH_STRING parameter exists.

Validation

Verifies that the CATALOG_SEARCH_STRING parameter is valid.

Exceptions

InvalidSessionStateException, thrown if the CATALOG_SEARCH_STRING parameter does not exist and the PipelineSessionConstants.CATALOG_SEARCH_RESULTS Pipeline session attribute has expired.

ProcessingException, thrown if the CATALOG_SEARCH_RESULTS parameter is invalid.

ExpressionSearchIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
ExpressionSearchIP

Description

Creates a ProductItemQuery based on a search expression HTTP request parameter and adds it to the Pipeline session.

Required HTTPServletRequest
Parameters

None

Optional HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_SEARCH_STRING

Required Pipeline Session Attributes

PipelineSessionConstants.CATALOG_QUERY. Required only if the CATALOG_SEARCH_STRING parameter does not exist.

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_QUERY

Removed Pipeline Session Attributes

PipelineSessionConstants.CATALOG_SEARCH_RESULTS if the CATALOG_SEARCH_STRING parameter exists.

Validation

Verifies that the CATALOG_SEARCH_STRING parameter is a valid expression.

Exceptions

InvalidSessionStateException, thrown if the CATALOG_SEARCH_STRING parameter does not exist and the PipelineSessionConstants.CATALOG_SEARCH_RESULTS Pipeline session attribute has expired.

ProcessingException, thrown if the CATALOG_SEARCH_STRING parameter is invalid.

MoveAttributeIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
MoveAttributeIP

Description

Sets Pipeline session attributes when moving a Pipeline session attribute value from a source attribute to a destination attribute. The source and destination attributes are specified as HTTP request parameters.

Required HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_SOURCE_KEY

HttpRequestConstants.CATALOG_DESTINATION_KEY

Optional HTTPServletRequest
Parameters

None

Required Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_SOURCE_KEY (Request scope)

PipelineSessionConstants.CATALOG_DESTINATION_KEY (Request scope)

Removed Pipeline
Session Attributes

None

Validation

Verifies that the CATALOG_SOURCE_KEY and the CATALOG_DESTINATION_KEY parameters are valid strings.

Exceptions

ProcessingException, thrown if either the source key or destination key is invalid.

RemoveAttributeIP

Class Name

com.beasys.commerce.ebusiness.catalog.webflow.
RemoveAttributeIP

Description

Sets Pipeline session attributes for removing a Pipeline session attribute value from a source attribute. The source attribute is specified as an HTTP request parameter.

Required HTTPServletRequest
Parameters

HttpRequestConstants.CATALOG_SOURCE_KEY

Optional HTTPServletRequest
Parameters

None

Required Pipeline Session Attributes

None

Updated Pipeline Session Attributes

PipelineSessionConstants.CATALOG_SOURCE_KEY (Request scope)

Removed Pipeline Session Attributes

None

Validation

Verifies that the CATALOG_SOURCE_KEY parameter is valid.

Exceptions

ProcessingException, thrown if the CATALOG_SOURCE_KEY parameter is invalid.

 


Pipeline Components

This section provides a brief description of each Pipeline component associated with the Product Catalog JSP templates.

CatalogPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.CatalogPC

Description

Base PipelineComponent for all Catalog-related PipelineComponents. This abstract class contains Catalog-related Pipeline utility methods.

Required Pipeline
Session Attributes

None

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

None

GetCategoryPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetCategoryPC

Description

Retrieves a Category based upon the CategoryKey in the Pipeline session CATALOG_CATEGORY_KEY attribute. The resultant Category is placed into the Pipeline session as the CATALOG_CATEGORY attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY_KEY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, EJB create error, or JNDI lookup error.

GetProductItemPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetProductItemPC

Description

Retrieves a ProductItem based upon the ProductItemKey contained in the Pipeline session CATALOG_ITEM_KEY attribute. The resultant ProductItem is placed into the Pipeline session as the CATALOG_ITEM attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_ITEM_KEY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_ITEM (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, Catalog create error, or JNDI lookup error.

GetParentPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetParentPC

Description

Retrieves the parent Category of the category contained in the Pipeline session CATALOG_CATEGORY attribute. The resultant Category is placed into the Pipeline session as the CATALOG_CATEGORY attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, Catalog create error, or JNDI lookup error.

GetAncestorsPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetAncestorsPC

Description

Retrieves the ancestor Categories of the Category contained in the Pipeline session CATALOG_CATEGORY attribute. The resultant Category array is placed into the Pipeline session as the CATALOG_ANCESTORS attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_ANCESTORS (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, Catalog create error, or JNDI lookup error.

GetProductItemsPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetProductItemsPC

Description

Retrieves the ProductItems associated with the Category contained in the Pipeline session CATALOG_CATEGORY attribute. The resultant ViewIterator of ProductItems is placed into the Pipeline session as the CATALOG_ITEMS attribute. The view size of the resultant ViewIterator may be specified with the optional CATALOG_VIEW_SIZE Pipeline session attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)


Optional Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_VIEW_SIZE (Request scope)

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_ITEMS (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, Catalog create error, or JNDI lookup error.

GetSubcategoriesPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
GetSubcategoriesPC

Description

Retrieves the sub-categories of the Category in the Pipeline session CATALOG_CATEGORY attribute. The resultant ViewIterator of Categories is placed into the Pipeline session as the CATALOG_CATEGORIES attribute. The view size of the resultant ViewIterator may be specified with the optional CATALOG_VIEW_SIZE Pipeline session attribute.

Required Pipeline Session Attributes

PipelineSessionConstants.CATALOG_CATEGORY (Request scope)


Optional Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_VIEW_SIZE (Request scope)

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_CATEGORIES (Request scope)

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, EJB create error, or JNDI lookup error.

MoveAttributePC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
MoveAttributePC

Description

Moves a Pipeline session attribute value from a source attribute to a destination attribute. The source and destination attributes are specified by the CATALOG_SOURCE_KEY and CATALOG_DESTINATION_KEY Pipeline session attributes.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_SOURCE_KEY (Request scope)

PipelineSessionConstants.CATALOG_DESTINATION_KEY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

Both request and session scoped Pipeline session attributes keyed by the CATALOG_DESTINATION_KEY Pipeline session attribute.

Removed Pipeline
Session Attributes

Both request and session scoped Pipeline session attributes keyed by the CATALOG_SOURCE_KEY Pipeline session attribute.

Type

Java object

JNDI Name

None

Exceptions

None

RemoveAttributePC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.
RemoveAttributePC

Description

Removes a Pipeline session attribute value from a source attribute. The source attribute is specified by the CATALOG_SOURCE_KEY Pipeline session attributes.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_SOURCE_KEY (Request scope)

Optional Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

Both request and session scoped Pipeline session attributes keyed by the CATALOG_SOURCE_KEY Pipeline session attribute.

Type

Java object

JNDI Name

None

Exceptions

None

SearchPC

Class Name

com.beasys.commerce.ebusiness.catalog.pipeline.SearchPC

Description

Performs a Catalog query based upon the CatalogQuery in the Pipeline session CATALOG_QUERY attribute. The resultant ViewIterator of ProductItems is placed into the Pipeline session as the CATALOG_SEARCH_RESULTS attribute. The view size of the resultant ViewIterator may be specified with the optional CATALOG_VIEW_SIZE Pipeline session attribute.

Required Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_QUERY (Request scope)


Optional Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_VIEW_SIZE (Request scope)

Updated Pipeline
Session Attributes

PipelineSessionConstants.CATALOG_SEARCH_RESULTS

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

PipelineFatalException on Catalog finder error, Catalog general error, EJB create error, or JNDI lookup error.

 


The Catalog JSP Tag Library: cat.tld

Table 5-21 summarizes the tags that comprise the WebLogic Commerce Server Product Catalog JSP Tag Library. To use the functionality provided by a catalog tag, you must import the cat.tld tag library into your JSP file, as follows:

<%@ taglib uri="cat.tld" prefix="catalog" %>

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.

The tag elements always start with <catalog: and are followed by the type of operation and one or more parameters. The operation, such as getProperty, always follows <catalog: without a space or breaking line. You do include a space between the tag element name and its parameters. Each parameter uses an equal sign and the parameter's value is enclosed in double quotes. End each tag with the forward slash, followed by the closing angle bracket: />.

Table 5-21 JSP Tag Library

Tag

Description

<catalog:getProperty>

Retrieves a property for display from a specified ProductItem or Category. Either explicit or implicit properties may be retrieved.

<catalog:iterateViewIterator>

Iterates a specified ViewIterator. The ViewIterator may be iterated either by View (one View per iteration) or by contained Catalog item (one ProductItem or Category per iteration).

<catalog:iterateThroughView>

Iterates a specified ViewIterator through the ProductItems or Categories contained within a specified View.

Subsequent sections in this chapter describe the tags in more detail.

Note: Items enclosed within brackets [ ] are optional.

The <catalog:getProperty> Tag

Use the <catalog:getProperty> tag 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.

Format

<catalog:getProperty

   object="<%= objectReference %>"

   propertyName="propertyName"

   [getterArgument="<%= getterArgumentReference %>"]

   [id="newInstance"]

   [returnType="returnType"]

/>

Attributes

object

Denotes a reference to a ProductItem or Category object that must be presented in the form <%= objectReference %>.

propertyName

Name of the property to retrieve. If the property is explicit, it may be one of the following values shown in Table 5-22.

Table 5-22 propertyName Values

Property Name

Catalog Item Type

"contributor | coverage | creationDate | creator | description | image | key | language | modifiedDate | name | publisher | relation | rights | source"

Catalog Item (common properties)

"jsp"

Category

"availability | currentPrice | format | jsp | msrp | shippingCode | taxCode | type | visible"

ProductItem

getterArgument

Denotes a reference to an object supplied as an argument to an explicit property getter method. The object must be presented in the form
<%= getterArgumentReference %>.

id

If the id attribute is supplied, the value of the retrieved property will be available in the variable name to which id is assigned. Otherwise, the value of the property is inlined.

returnType

If the id attribute is supplied, declares the type of the variable specified by the id attribute.

Example

The following example retrieves the Detail JSP information from an existing ProductItem:

<catalog:getProperty 

object="<%= item %>" 

   propertyName="Jsp" 

   getterArgument=

   "<%= new Integer(ProductItem.DETAILED_DISPLAY_JSP_INDEX) %>"

   id="detailJspInfo"

returnType="com.beasys.commerce.ebusiness.catalog.JspInfo"

/>

The <catalog:iterateViewIterator> Tag

Use this 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.

Format

<catalog:iterateViewIterator

   iterator="<%= iteratorReference %>"

   id="newInstance"

   [returnType="returnType"]

   [iterateByView="{true|false}"]>

<catalog:iterateViewIterator/>

Attributes

iterator

Denotes a reference to a ViewIterator object that must be presented in the form <%= iteratorReference %>.

id

The value of the current iterated object will be available in the variable name to which the id is assigned.

returnType

Declares the type of the variable specified by the id attribute. Defaults to java.lang.Object. If iterateByView is true, the type is assumed to be com.beasys.commerce.ebusiness.catalog.View.

iterateByView

Specifies whether to iterate the ViewIterator by View or by Catalog item. If not specified, the ViewIterator will be iterated by Catalog item.

Examples

The following example displays the keys of all Categories in a ViewIterator:

<catalog:iterateViewIterator 

   iterator="<%= myIterator %>" 

   id="category"

   returnType="com.beasys.commerce.ebusiness.catalog.Category">

   <%= category.getKey().toString() %>

</catalog:iterateViewIterator>

The following example displays all the Views contained within a ViewIterator:

<catalog:iterateViewIterator 

   iterator="<%= myIterator %>" 

   id="view"

   returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"

   iterateByView="true">

   <%= view.toString() %>

</catalog:iterateViewIterator>

The <catalog:iterateThroughView> Tag

Use this tag to iterate 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.

Format

<catalog:iterateThroughView

   iterator="<%= iteratorReference %>"

   id="newInstance"

   [returnType="returnType"]

   [viewIndex="<%= viewIndexIntegerReference %>"]>

</catalog:iterateThroughView>

Attributes

iterator

Denotes a reference to a ViewIterator object that must be presented in the form <%= iteratorReference %>

id

The value of the current iterated object will be available in the variable name to which the id is assigned.

returnType

Declares the type of the variable specified by the id attribute. Defaults to java.lang.Object.

viewIndex

Specifies the index of the View (relative to the start of the ViewIterator) through which to iterate. The referenced object must be presented in the form <%= viewIndexIntegerReference %>.

Examples

The following example displays the keys of all the ProductItems contained in the current View of a specified ViewIterator:

<catalog:iterateThroughView 

   iterator="<%= myIterator %>"

   id="item"

   returnType="com.beasys.commerce.ebusiness.catalog.ProductItem">

<%= item.getKey().toString() %>

</catalog:iterateThroughView>

The following example displays the keys of all the ProductItems contained in the first View of a specified ViewIterator:

<catalog:iterateThroughView 

   iterator="<%= myIterator %>"

   id="item"

   returnType="com.beasys.commerce.ebusiness.catalog.ProductItem"

   viewIndex="new Integer(0)">

   <%= item.getKey().toString() %>

</catalog:iterateThroughView>