BEA Logo BEA WebLogic Commerce Server Release Beta

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

 

   WebLogic Commerce Server Doc Home   |   Registration and User Processing Package   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Customer Profile Services

 

Customers who have registered with your e-commerce site may, from time to time, change the information stored in their profile. For example, customers may want to send a shipment to a different address, or use a different credit card. To help you meet your customers' needs, the Registration and User Processing Package provides you with an implementation of these Customer Profile Services. This topic describes the pages that allow registered customers to modify various aspects of their customer profile.

This topic includes the following sections:

 


JavaServer Pages (JSPs)

The Registration and User Processing package contains a number of JavaServer Pages (JSPs) that allow customers to view or update their stored profile. Remember, you can always use these templates for your Web site, or you can adapt them to meet your specific needs. This section describes each of these pages in detail.

viewprofile.jsp Template

The viewprofile.jsp template (shown in Figure 3-1) allows a registered customer to view their existing profile information. It displays the existing information in four categories: personal information, shipping addresses, credit cards, and username and password. There are options in each category for updating, deleting, or adding information.

Sample Browser View

Figure 3-1 shows an annotated version of the viewprofile.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 3-1 Annotated viewprofile.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 displays the customer's existing personal information using the WebLogic Server JSP tags and the WebLogic Personalization Server's User Management JSP tags. It also provides customers with a button that will allow customers to update their existing personal information (using the editprofile.jsp template).

  3. This region displays any shipping addresses the customer may have previously stored as part of their customer profile. This is accomplished using the WebLogic Server JSP tags and the WebLogic Personalization Server's User Management JSP tags. In this region, your customer can choose from buttons that allow them to delete an address, enter a new shipping address (using the profilenewaddress.jsp tempate), or update an existing address (using the profileeditaddress.jsp template).

  4. If any exists, region 4 displays the customer's existing credit card (payment) information using a combination of the WebLogic Server JSP tags and the WebLogic Personalization Server's User Management JSP tags. For each credit card shown, your customer can decide to delete the card, enter a new credit card (using the profilenewcc.jsp template), or change the information associated with the card (using the profileeditcc.jsp template).

  5. This region displays the customer's current username, and provides customers with a button that will allow them to modify their password (using the changepassword.jsp template).

  6. The viewprofile.jsp template's content in region 6 contains the included innerfooter.jsp template. The include call in viewprofile.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 viewprofile.jsp template 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\user\
viewprofile.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
viewprofile.jsp
(UNIX)

Tag Library Imports

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

<%@ taglib uri="weblogic.tld" prefix="wl" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information on the WebLogic Server JSP tags or 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 viewprofile.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%@ page import="com.beasys.commerce.webflow.PipelineSessionConstants" %>
<%@ page import="com.beasys.commerce.webflow.tags.WebFlowTagConstants" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.*" %>

Location in Default Webflow

If the customer is not logged in, the page prior to the viewprofile.jsp template is the customer login page (login.jsp). If the customer is already logged in, the page prior to the viewprofile.jsp template is any page from which the customer clicks the View Profile button. Based on what the customer decides to do after viewing their profile, the next page could be any of the following:

Each of these pages are described in subsequent sections of this document.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the viewprofile.jsp template:

Events

The viewprofile.jsp template presents a customer with several buttons, each of which is considered an event. These events trigger a particular response 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 or Pipeline is invoked first. Table 3-1 provides information about these events and the business logic they invoke.

Table 3-1 viewprofile.jsp Events

Event

Web Flow Response(s)

button(updateBasicInfo)

No business logic required. Loads editprofile.jsp.

button(addNewShippingAddress)

No business logic required. Loads profilenewaddress.jsp.

button(updateShippingInfo)

No business logic required. Loads profileeditaddress.jsp.

button(deleteShippingAddress)

DeleteShippingAddressIP

DeleteShippingAddressFromProfile

button(addNewCreditCard)

No business logic required. Loads profilenewcc.jsp.

button(updatePaymentInfo)

No business logic required. Loads profileeditcc.jsp.

button(deletePaymentInfo)

DeleteCreditCardIP

DeleteCreditCard

button(changePassword)

No business logic required. Loads changepassword.jsp.

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

Table 3-2 View Profile Pipelines

Pipeline

Description

DeleteShippingAddressFromProfile

Contains UpdateShippingInfoPC and is transactional.

DeleteCreditCard

Contains UpdatePaymentInfoPC and is transactional.

Dynamic Data Display

One purpose of the viewprofile.jsp template is to display the profile information a customer had previously entered. This is accomplished on viewprofile.jsp using a combination of WebLogic Server JSP tags, the WebLogic Personalization Server's User Management JSP tags, and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, as shown in Listing 3-1.

Listing 3-1 Setting the Customer Context


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


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.

Next, the getProperty JSP tag is used to obtain the customer's contact address, a collection of the customer's shipping addresses, and a collection of the customer's credit cards, which are then initialized with data from their corresponding objects. This is shown in Listing 3-2.

Listing 3-2 Obtaining the Customer's Profile Information


<um:getProperty propertyName="contactAddress"
id="contactAddressObject" />

<um:getProperty propertyName="shippingAddressMap"
id="shippingAddressMapObject" />

<um:getProperty propertyName="creditCardsMap"
id="creditCardsMapObject" />

Address contactAddress = (Address) contactAddressObject;
Map shippingAddressMap = (Map) shippingAddressMapObject;
Map creditCardsMap = (Map) creditCardsMapObject;


The data stored within these objects can now be accessed by calling accessor methods/attributes within Java scriptlets. Table 3-3 provides more detailed information about the methods/attributes for both the contact and shipping addresses. Table 3-4 provides information about the methods/attributes for the customer's credit cards.

Table 3-3 contactAddress/shippingAddress Accessor Methods/Attributes

Method/Attribute

Description

getStreet1()

The first line in the customer's contact or shipping street address.

getStreet2()

The second line in the customer's contact or shipping street address.

getCity()

The city in the customer's contact or shipping address.

getCounty()

The county in the customer's contact or shipping address.

getState()

The state in the customer's contact or shipping address.

getPostalCode()

The zip/postal code in the customer's contact or shipping address.

getCountry()

The country in the customer's contact or shipping address.

Table 3-4 creditCard Accessor Methods/Attributes

Method/Attribute

Description

creditCard

The credit card name, consisting of the credit card type and 4 digits (for example, VISA-4111).

Listing 3-3 illustrates how these accessor methods/attributes are used within Java scriptlets.

Listing 3-3 Using Accessor Methods/Attributes Within viewprofile.jsp Java Scriptlets


<table>
.
.
.
<tr>
<td><div class="tabletext"><b>Address</b></div></td>
<td><div class="tabletext">
<%=contactAddress.getStreet1()%><br>
<%=contactAddress.getStreet2()%><br>
<%=contactAddress.getCity()%><br>
<%=contactAddress.getState()%> &nbsp;
<%=contactAddress.getPostalCode()%><br>
<%=contactAddress.getCountry()%></div>
</td>
</tr>
.
.
.
<wl:repeat
set="<%=((Map)creditCardsMapObject).keySet().iterator()%>"
id="creditCard" type="String" count="100000">

<tr>
<td width="55%">
<div class="tabletext"><b><%=creditCard%></b></div>
<td>
</tr>

</wl:repeat>

</table>


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

The getPropertyAsString JSP tag is used to directly obtain the customer's first and last name, the customer's home and business phone numbers, and the customer's email address. Listing 3-4 illustrates how to use the getPropertyAsString JSP tag to display ths customer's name in the welcome message at the top of the viewprofile.jsp template.

Listing 3-4 Obtaining the Customer's Name


<p class="head1">
<um:getPropertyAsString propertyName="firstName" /> <um:getPropertyAsString propertyName="lastName" />'s Profile
</p>


Form Field Specification

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

editprofile.jsp Template

The editprofile.jsp template (shown in Figure 3-2) allows a registered customer to update the personal information in their stored profile, which includes their name, address, home and business phone numbers, and email address.

Sample Browser View

Figure 3-2 shows an annotated version of the editprofile.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 3-2 Annotated editprofile.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to change their personal information. Where available, existing data for the customer is dynamically displayed in the form fields using WebLogic Server and the WebLogic Personalization Server's User Management JSP tags. For the address, this region utilizes the form fields defined in the included states.jsp and countries.jsp template files. The import calls are:

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

  3. The editprofile.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in editprofile.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 editprofile.jsp template 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\user\
editprofile.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
editprofile.jsp
(UNIX)

Tag Library Imports

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

<%@ taglib uri="weblogic.tld" prefix="wl" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information on the WebLogic Server JSP tags or 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 editprofile.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before editprofile.jsp is the page on which a customer can view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, editprofile.jsp is reloaded with an appropriate error message.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

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

Events

The editprofile.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-5 provides information about these events and the business logic they invoke.

Table 3-5 editprofile.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdateBasicInfoIP

EditBasicInfo

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

Table 3-6 Edit Profile Pipelines

Pipeline

Description

EditBasicInfo

Contains UpdateBasicInfoPC and is transactional.

Dynamic Data Display

One purpose of the editprofile.jsp template is to display the profile information a customer had previously entered. This is accomplished on the editprofile.jsp template using a combination of WebLogic Server JSP tags, the WebLogic Personalization Server's User Management JSP tags, and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, as shown in Listing 3-5.

Listing 3-5 Setting the Customer Context


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


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.

Next, the getProperty JSP tag is used to obtain the customer's contact address, which is then initialized with data from the customer object, as shown in Listing 3-6.

Listing 3-6 Obtaining the Customer's Contact Address


<um:getProperty propertyName="contactAddress" 
id="contactAddressObject" />
<% Address contactAddress = (Address) contactAddressObject; %>


The data stored within the contactAddress object can now be accessed by calling accessor methods/attributes within Java scriptlets. Table 3-7 provides more detailed information about the methods/attributes for the contact address.

Table 3-7 contactAddress Accessor Methods/Attributes

Method/Attribute

Description

getStreet1()

The first line in the customer's contact street address.

getStreet2()

The second line in the customer's contact street address.

getCity()

The city in the customer's contact address.

getCounty()

The county in the customer's contact address.

getState()

The state in the customer's contact address.

getPostalCode()

The zip/postal code in the customer's contact address.

getCountry()

The country in the customer's contact address.

Note: The getPropertyAsString JSP tag is used to directly obtain the customer's first and last name, the customer's home and business phone numbers, and the customer's email address. Listing 3-7 illustrates how to use the getPropertyAsString JSP tag to obtain the customer's last name.

Listing 3-7 Obtaining the Customer's Last Name


<um:getPropertyAsString propertyName="lastName" id="lastName" />


Listing 3-8 illustrates how these accessor methods/attributes are used within Java scriptlets to display existing data within the form fields.

Listing 3-8 Using Accessor Methods/Attributes within editprofile.jsp Java Scriptlets


<table>
<tr>

  <um:getPropertyAsString propertyName="lastName" id="lastName" />

  <td>
<webflow:getValidatedValue
fieldName="<%=HttpRequestConstants.CUSTOMER_LAST_NAME%>"
fieldDefaultValue="<%=(String)lastName%>"
fieldValue="customerLastName" fieldStatus="status" validColor="black"
invalidColor="red" unspecifiedColor="black" fieldColor="fontColor" />

    <div class="tabletext">
<font color=<%= fontColor %>>Last name </font>
</div>
</td>

  <td>
<input type="text" name="<%=HttpRequestConstants.CUSTOMER_LAST_NAME%>"
value="<%=customerLastName%>">*
</td>

</tr><tr>

  <td>
<webflow:getValidatedValue
fieldName="<%=HttpRequestConstants.CUSTOMER_ADDRESS1%>"
fieldDefaultValue="<%=contactAddress.getStreet1()%>"
fieldValue="customerAddress1" fieldStatus="status" validColor="black"
invalidColor="red" unspecifiedColor="black" fieldColor="fontColor" />

    <div class="tabletext">
<font color=<%= fontColor %>>Street address</font>
</div>
</td>

  <td>
<input type="text" name="<%=HttpRequestConstants.CUSTOMER_ADDRESS1%>"
value="<%=customerAddress1%>">*
</td>

</tr>
</table>


Form Field Specification

The primary purpose of the editprofile.jsp template is to allow customers to edit their profile information using various HTML form fields. It is also used to pass needed information to the Webflow.

The form fields used in the editprofile.jsp template, and a description for each of these form fields are listed in Table 3-8.

Table 3-8 editprofile.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (editprofile.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_FIRST_NAME

Textbox

The customer's first name.

HttpRequestConstants.
CUSTOMER_MIDDLE_NAME

Textbox

The customer's middle initial.

HttpRequestConstants.
CUSTOMER_LAST_NAME

Textbox

The customer's last name.

HttpRequestConstants.
CUSTOMER_ADDRESS1

Textbox

The first line in the customer's street address.

HttpRequestConstants.
CUSTOMER_ADDRESS2

Textbox

The second line in the customer's street address.

HttpRequestConstants.
CUSTOMER_CITY

Textbox

The city in the customer's address.

HttpRequestConstants.
CUSTOMER_STATE

Listbox

The state in the customer's address.

HttpRequestConstants.
CUSTOMER_ZIPCODE

Textbox

The zip code in the customer's address.

HttpRequestConstants.
CUSTOMER_COUNTRY

Listbox

The country in the customer's address.

HttpRequestConstants.
CUSTOMER_HOME_PHONE

Textbox

The customer's home phone number.

HttpRequestConstants.
CUSTOMER_BUSINESS_PHONE

Textbox

The customer's business phone number.

HttpRequestConstants.
CUSTOMER_EMAIL

Textbox

The customer's email address.

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

profilenewaddress.jsp Template

The profilenewaddress.jsp template (shown in Figure 3-3) allows a registered customer to add a new shipping address to their stored profile.

Sample Browser View

Figure 3-3 shows an annotated version of the profilenewaddress.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 3-3 Annotated profilenewaddress.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to add a shipping address. This region utilizes the form fields defined in the included newaddresstemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The import call in profilenewaddress.jsp is:

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

  3. The profilenewaddress.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in profilenewaddress.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 profilenewaddress.jsp template 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\user\
profilenewaddress.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
profilenewaddress.jsp
(UNIX)

Tag Library Imports

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

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

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

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 profilenewaddress.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before profilenewaddress.jsp is the page on which a customer can view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, profilenewaddress.jsp is reloaded with an appropriate error message.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the profilenewaddress.jsp template:

Events

The profilenewaddress.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-9 provides information about these events and the business logic they invoke.

Table 3-9 profilenewaddress.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdateAddressInfoIP

ProfileNewAddress

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

Table 3-10 New Profile Shipping Address Pipelines

Pipeline

Description

ProfileNewAddress

Contains UpdateShippingInfoPC and is transactional.

Dynamic Data Display

No dynamic data is presented on the profilenewaddress.jsp template.

Form Field Specification

The primary purpose of the profilenewaddress.jsp template is to allow customers to enter a new shipping address using various HTML form fields. It is also used to pass needed information to the Webflow.

The form fields used in the profilenewaddress.jsp template (most of which are actually imported from the newaddresstemplate.jsp file), and a description for each of these form fields are shown in Table 3-11.

Table 3-11 profilenewaddress.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (profilenewaddress.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS1

Textbox

The first line in the customer's street address.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS2

Textbox

The second line in the customer's street address.

HttpRequestConstants.
CUSTOMER_SHIPPING_CITY

Textbox

The city in the customer's address.

HttpRequestConstants.
CUSTOMER_SHIPPING_STATE

Listbox

The state in the customer's address.

HttpRequestConstants.
CUSTOMER_SHIPPING_ZIPCODE

Textbox

The zip code in the customer's address.

HttpRequestConstants.
CUSTOMER_SHIPPING_COUNTRY

Listbox

The country in the customer's address.

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

profileeditaddress.jsp Template

The profileeditaddress.jsp template (shown in Figure 3-4) allows a registered customer to update the shipping address information stored as part of their profile.

Sample Browser View

Figure 3-4 shows an annotated version of the profileeditaddress.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 3-4 Annotated profileeditaddress.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to update a shipping address. This region utilizes the form fields defined in the included editaddresstemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The import call in profileeditaddress.jsp is:

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

  3. The profileeditaddress.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in profileeditaddress.jsp is:

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

    innerfooter.jsp 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 innerfooter.jsp file, the right-side vertical column is an include file:

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

Location in WebLogic Commerce Server Directory Structure

You can find the profileeditaddress.jsp template 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\user\
profileeditaddress.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
profileeditaddress.jsp
(UNIX)

Tag Library Imports

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

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>

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. For more information about the Webflow JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

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 profileeditaddress.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before the profileeditaddress.jsp template is the page that allows a customer to view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, the profileeditaddress.jsp template is reloaded with an appropriate error message.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the profileeditaddress.jsp template:

About the Included editaddresstemplate.jsp Template

The editaddresstemplate.jsp template (included in all JSP templates that allow customers to edit a shipping address) provides a standardized format for both the form field presentation and error handling. The form fields are organized in a table, and upon form submission, the input processors associated with the editaddresstemplate.jsp template will validate the form to ensure that all required fields contain values. If errors are detected, the editaddresstemplate.jsp template will be redisplayed, with an error message at the top and the offending field labels shown in red (as opposed to the original black) font. Further, the information your customer entered correctly will still be displayed in the form.

Since the editaddresstemplate.jsp template allows customers to edit an existing shipping address, the form fields on the page are also prefilled with information previously entered by the customer.

The behavior described above is accomplished on the editaddresstemplate.jsp template using the getValidatedValue JSP tag and the accessor methods/attributes for defaultShippingAddress, as shown in Listing 3-9.

Listing 3-9 Use of the getValidatedValue JSP Tag and Accessor Methods/Attributes on editaddresstemplate.jsp


<table>
<tr>

<!-- Use the webflow:getValidatedValue to retrieve the default value for the shipping address from the HttpRequest. This value was placed there by the CustomerProfileIP input processor. Use the defaultShippingAddress to display the first line using its getStreet1() accessor method. -->

<tr>
<td>
<webflow:getValidatedValue
fieldName="<%=HttpRequestConstants.CUSTOMER_SHIPPING_ADDRESS1%>"
fieldDefaultValue="<%=defaultShippingAddress.getStreet1()%>"
fieldValue="customerShippingAddress1" fieldStatus="status"
validColor="black" invalidColor="red" unspecifiedColor="black"
fieldColor="fontColor" />

     <div class="tabletext">
<font color=<%= fontColor %>>Street address</font>
</div>

  </td>

  <td>
<input type="text"
name="<%=HttpRequestConstants.CUSTOMER_SHIPPING_ADDRESS1%>"
value="<%=customerShippingAddress1%>" maxlength="30">*
</td>

</tr>
</table>


Notes: For more information about the getValidatedValue JSP tag, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

For a list of the available accessor methods/attributes for defaultShippingAddress, see Table 3-14.

Because the editaddresstemplate.jsp template collects address information, this template also includes states.jsp and countries.jsp where appropriate.

Events

The profileeditaddress.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-12 provides information about these events and the business logic they invoke.

Table 3-12 profileeditaddress.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdateShippingInfoIP

ProfileEditAddress

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

Table 3-13 Edit Profile Shipping Address Pipelines

Pipeline

Description

ProfileEditAddress

Contains UpdateShippingInfoPC and is transactional.

Dynamic Data Display

One purpose of the profileeditaddress.jsp template is to prepare the address information a customer had previously entered, so the editaddresstemplate.jsp template can display this information in the address form fields. This is accomplished on the profileeditaddress.jsp template using a combination of Webflow JSP tags, the WebLogic Personalization Server's User Management JSP tags, and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, as shown in Listing 3-10.

Listing 3-10 Setting the Customer Context


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


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.

Next, the getProperty JSP tag is used to obtain a list of the customer's shipping addresses, which are then initialized with data from the customer object, as shown in Listing 3-11.

Listing 3-11 Obtaining the Customer's Shipping Address


<um:getProperty propertyName="shippingAddressMap" 
id="shippingAddressMapObject" />

<% Map shippingAddressMap = (Map) shippingAddressMapObject;
String addressKey = request.getParameter(HttpRequestConstants.ADDRESS_KEY);
Address defaultShippingAddress = (Address) shippingAddressMap.get(addressKey);
%>


The data stored within the defaultShippingAddress object can now be accessed by calling accessor methods/attributes within Java scriptlets. Table 3-14 provides more detailed information about the methods/attributes for the default shipping address.

Table 3-14 defaultShippingAddress Accessor Methods/Attributes

Method/Attribute

Description

getStreet1()

The first line in the customer's shipping street address.

getStreet2()

The second line in the customer's shipping street address.

getCity()

The city in the customer's shipping address.

getCounty()

The county in the customer's shipping address.

getState()

The state in the customer's shipping address.

getPostalCode()

The zip/postal code in the customer's shipping address.

getCountry()

The country in the customer's shipping address.

Form Field Specification

The primary purpose of the profileeditaddress.jsp template is to allow customers to edit their profile information using various HTML form fields. It is also used to pass needed information to the Webflow.

The form fields used in the profileeditaddress.jsp template (most of which are actually imported from the editaddresstemplate.jsp file), and a description for each of these form fields are listed in Table 3-15.

Table 3-15 profileeditaddress.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (profileeditaddress.
jsp
), used by the Webflow.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS1

Textbox

The first line in the customer's shipping address.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS2

Textbox

The second line in the customer's shipping address.

HttpRequestConstants.
CUSTOMER_SHIPPING_CITY

Textbox

The city in the customer's shipping address.

HttpRequestConstants.
CUSTOMER_SHIPPING_STATE

Listbox

The state in the customer's shipping address.

HttpRequestConstants.
CUSTOMER_SHIPPING_ZIPCODE

Textbox

The zip/postal code in the customer's shipping address.

HttpRequestConstants.
CUSTOMER_SHIPPING_COUNTRY

Listbox

The country in the customer's shipping address.

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

profilenewcc.jsp Template

The profilenewcc.jsp template (shown in Figure 3-5) allows an existing customer to add new credit card information, which will be stored as part of their profile.

Sample Browser View

Figure 3-5 shows an annotated version of the profilenewcc.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 3-5 Annotated profilenewcc.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to enter payment information related to a new credit card. This region utilizes the form fields defined in the included newcctemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The include call in profilenewcc.jsp is:

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

  3. The profilenewcc.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in profilenewcc.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 profilenewcc.jsp template 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\user\
profilenewcc.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
profilenewcc.jsp
(UNIX)

Tag Library Imports

The profilenewcc.jsp template uses the Webflow JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="webflow.tld" prefix="webflow" %>

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

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 profilenewcc.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before the profilenewcc.jsp template is the page on which a customer can view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, the profilenewcc.jsp template is reloaded.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the profilenewcc.jsp template:

Events

The profilenewcc.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-16 provides information about these events and the business logic they invoke.

Table 3-16 profilenewcc.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdatePaymentInfoIP

NewCreditCard

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

Table 3-17 New Credit Card Pipelines

Pipeline

Description

NewCreditCard

Contains EncryptCreditCardPC and UpdatePaymentInfoPC, and is transactional.

Dynamic Data Display

No dynamic data is presented on the profilenewcc.jsp template.

Form Field Specification

The primary purpose of the profilenewcc.jsp template is to allow customers to enter new credit card information using various HTML form fields. It is also used to pass needed information to the Webflow.

The form fields used in the profilenewcc.jsp template (most of which are actually imported from the newcctemplate.jsp file), and a description for each of these form fields are listed in Table 3-18.

Table 3-18 profilenewcc.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (profilenewcc.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_CREDITCARD_TYPE

Listbox

The type of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_HOLDER

Textbox

The name on the credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_NUMBER

Textbox

The number of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_MONTH

Listbox

The month of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_YEAR

Listbox

The year of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS1

Textbox

The first line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS2

Textbox

The second line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_CITY

Textbox

The city in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_STATE

Listbox

The state in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ZIPCODE

Textbox

The zip/postal code in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_COUNTRY

Listbox

The country in the customer's billing address.

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

profileeditcc.jsp Template

The profileeditcc.jsp template (shown in Figure 3-6) allows a customer to edit existing credit card information, which will be stored as part of their profile.

Sample Browser View

Figure 3-6 shows an annotated version of the profileeditcc.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 3-6 Annotated profileeditcc.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to update their payment information related to a credit card. This region utilizes the form fields defined in the included editcctemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The import call in profileeditcc.jsp is:

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

  3. The profileeditcc.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in profileeditcc.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 profileeditcc.jsp template 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\user\
profileeditcc.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
profileeditcc.jsp
(UNIX)

Tag Library Imports

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

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information about the Webflow JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. 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 profileeditcc.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before the profileeditcc.jsp template is the page on which a customer can view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, profileeditcc.jsp is reloaded.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the profileeditcc.jsp template:

About the Included editcctemplate.jsp Template

The editcctemplate.jsp template (included in all JSP templates that allow customers to edit a credit card) provides a standardized format for both the form field presentation and error handling. The form fields are organized in a table, and upon form submission, the input processors associated with the editcctemplate.jsp template will validate the form to ensure that all required fields contain values. If errors are detected, the editcctemplate.jsp template will be redisplayed, with an error message at the top and the offending field labels shown in red (as opposed to the original black) font. Further, the information your customer entered correctly will still be displayed in the form.

Since the editcctemplate.jsp template allows customers to edit an existing shipping address, the form fields on the page are also prefilled with information previously entered by the customer.

The behavior described above is accomplished on the editcctemplate.jsp template using the getValidatedValue JSP tag and the accessor methods/attributes for defaultCreditCard, as shown in Listing 3-12.

Listing 3-12 Use of the getValidatedValue JSP Tag and Accessor Methods/Attributes on editcctemplate.jsp


<table>
<tr>

<!-- use the webflow:getValidatedValue to retrieve a value from the HttpRequest. This value was placed there by the CustomerProfileIP input processor -->

  <td> 
<webflow:getValidatedValue
fieldName="<%=HttpRequestConstants.CUSTOMER_CREDITCARD_HOLDER%>"
fieldDefaultValue="<%=defaultCreditCard.getName()%>"
fieldValue="customerCreditCardHolder" fieldStatus="status"
validColor="black" invalidColor="red" unspecifiedColor="black"
fieldColor="fontColor" />

     <div class="tabletext">
<font color=<%= fontColor %>>Name on card</font>
</div>
</td>

  <td>
<input type="text"
name="<%=HttpRequestConstants.CUSTOMER_CREDITCARD_HOLDER%>"
value="<%=customerCreditCardHolder%>">*
</td>

</tr>
</table>


Notes: For more information about the getValidatedValue JSP tag, see BEA WebLogic Commerce Server Webflow and Pipeline Management.

For a list of the available accessor methods/attributes for defaultCreditCard, see Table 3-21.

Because the editcctemplate.jsp template collects address information, this template also includes states.jsp and countries.jsp where appropriate.

Events

The profileeditcc.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-19 provides information about these events and the business logic they invoke.

Table 3-19 profileeditcc.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdatePaymentInfoIP

UpdateCreditCard

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

Table 3-20 Edit Credit Card Pipelines

Pipeline

Description

UpdateCreditCard

Contains UpdatePaymentPC and is transactional.

Dynamic Data Display

One purpose of the profileeditcc.jsp template is to prepare the credit card information a customer had previously entered, so the editcctemplate.jsp template can display this information in the payment information form fields. This is accomplished on the profileeditcc.jsp template using a combination the WebLogic Personalization Server's User Management JSP tags and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, as shown in Listing 3-13.

Listing 3-13 Setting the Customer Context


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


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.

Next, the getProperty JSP tag is used to obtain the customer's list of credit cards (and related billing information), which is then initialized with data from the customer object, as shown in Listing 3-14.

Listing 3-14 Obtaining the Customer's Credit Cards and Billing Information


<um:getProperty propertyName="creditCardsMap" 
id="creditCardsMapObject" />

<% 

Map creditCardsMap = (Map) creditCardsMapObject;
String creditCardKey =
request.getParameter(HttpRequestConstants.CREDITCARD_KEY);
CreditCard defaultCreditCard = null;
defaultCreditCard = (CreditCard) creditCardsMap.get(creditCardKey);
Address billingAddress = (Address) defaultCreditCard.getBillingAddress();

%>


The data stored within the defaultCreditCard and billingAddress objects can now be accessed by calling accessor methods/attributes within Java scriptlets. Table 3-21 provides more detailed information about the methods/attributes for the default credit card, while Table 3-22 provides more information about the accessor methods/attributes on billingAddress.

Table 3-21 defaultCreditCard Accessor Methods/Attributes

Method/Attribute

Description

getType()

The credit card type (VISA, MasterCard, AMEX, etc.).

getName()

The credit card holder's name.

getDisplayNumber()

The credit card number for display (12 Xs and last 4 digits).

getNumber()

The credit card number.

getExpirationDate()

The credit card's expiration date.

Table 3-22 billingAddress Accessor Methods/Attributes

Method/Attribute

Description

getStreet1()

The first line in the customer's billing street address.

getStreet2()

The second line in the customer's billing street address.

getCity()

The city in the customer's billing address.

getCounty()

The county in the customer's billing address.

getState()

The state in the customer's billing address.

getPostalCode()

The zip/postal code in the customer's billing address.

getCountry()

The country in the customer's billing address.

Form Field Specification

Another purpose of the profileeditcc.jsp template is to allow customers to make changes to their credit card information using various HTML form fields. Unknown to your customers, it is also used to pass needed information to the Webflow.

The form fields used in the profileeditcc.jsp template (most of which are actually imported from the editcctemplate.jsp file), and a description for each of these fields are listed in Table 3-23.

Table 3-23 profileeditcc.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (profileeditcc.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_CREDITCARD_KEY_ORIGINAL

Hidden

The map key of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_TYPE

Listbox

The type of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_HOLDER

Textbox

The name on the credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_NUMBER

Textbox

The number of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_DISPLAY_NUMBER

Hidden

The display version of the customer's credit card (12 Xs and last 4 digits).

HttpRequestConstants.
CUSTOMER_CREDITCARD_MONTH

Listbox

The month of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_YEAR

Listbox

The year of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS1

Textbox

The first line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS2

Textbox

The second line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_CITY

Textbox

The city in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_STATE

Listbox

The state in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ZIPCODE

Textbox

The zip/postal code in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_COUNTRY

Listbox

The country in the customer's billing address.

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

changepassword.jsp Template

The changepassword.jsp template (shown in Figure 3-7) allows a customer to change their password, which will be stored as part of their profile.

Sample Browser View

Figure 3-7 shows an annotated version of the changepassword.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 3-7 Annotated changepassword.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 innerheader.jsp template. This is standard across many of the JSP templates provided by WebLogic Commerce Server. The import call is:

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

  2. Region 2 provides customers with a series of form fields that allow customers to change their password, by first entering their old password, then entering and confirming their new password.

  3. The changepassword.jsp template's content in region 3 contains the included innerfooter.jsp template. The include call in changepassword.jsp is:

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

    innerfooter.jsp 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 innerfooter.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 changepassword.jsp template 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\user\
changepassword.jsp
(Windows)
$WL_COMMERCE_HOME/server/webapps/wlcs/commerce/user/
changepassword.jsp
(UNIX)

Tag Library Imports

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

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information about the Webflow JSP tags, see BEA WebLogic Commerce Server Webflow and Pipeline Management. 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 changepassword.jsp template uses Java classes in the following packages and therefore includes these import statements:

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

Location in Default Webflow

The page before the changepassword.jsp template is the page on which a customer can view their current profile (viewprofile.jsp). If there are no errors in the form submission, the next page in the default Webflow is viewprofile.jsp. If corrections do need to be made, changepassword.jsp is reloaded.

Note: For more information about the default Webflow, see Overview of the Registration and User Processing Package.

Included JSP Templates

The following JSP templates are included in the changepassword.jsp template:

Events

The changepassword.jsp template presents customers with two button events that trigger a particular response in the default Webflow, thereby allowing customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 3-24 provides information about these events and the business logic they invoke.

Table 3-24 changepassword.jsp Events

Event

Webflow Response(s)

button(back)

No business logic required. Loads viewprofile.jsp.

button(save)

UpdateAccountInfoIP

UpdateAccountProfile

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

Table 3-25 Change Password Pipelines

Pipeline

Description

UpdateAccountProfile

Contains UpdatePasswordPC and is transactional.

Dynamic Data Display

One purpose of the changepassword.jsp template is to display the customer's username. This is accomplished on the changepassword.jsp template using a simple Java scriptlet, as shown in Listing 3-15.

Listing 3-15 Displaying the Customer's Username


...

<td>
<div class="tabletext">
<b><%=request.getRemoteUser()%></b>
</div>
</td>

...


Note: Customers cannot change their username, only their password. If the New Password and Confirm New Password form fields are not filled in correctly, the page is displayed with all fields empty (that is, no fields are dynamically prefilled upon reload).

Form Field Specification

The primary purpose of the changepassword.jsp template is to allow customers to make changes to their password using HTML form fields. It is also used to pass needed information to the Webflow.

The form fields used in the changepassword.jsp template, and a description for each of these form fields are listed in Table 3-26.

Table 3-26 changepassword.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (changepassword.jsp), used by the Webflow.

HttpRequestConstants.
PASSWORD

Password

The customer's existing password used to login.

HttpRequestConstants.
NEW_PASSWORD

Password

The new password chosen by the customer for login.

HttpRequestConstants.
CONFIRM_PASSWORD

Password

Confirmation of the new password chosen by the customer for login.

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

 


Input Processors

This section provides a brief description of each input processor associated with the Customer Profile Services JSP template(s).

DeleteCreditCardIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

DeleteCreditCardIP

Description

Deletes a CreditCard from the CreditCardMap and creates a new CustomerValue object; then sets the CreditCardMap on CustomerValue and places it into the Pipeline session.

Required HTTPServletRequest
Parameters

HttpRequestConstants.CREDITCARD_KEY

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

Removed Pipeline
Session Attributes

None

Validation

Verifies that HttpRequestConstants.CREDITCARD_KEY is not NULL.

Exceptions

InvalidInputException, thrown if HttpRequestConstants.CREDITCARD_KEY is NULL.

InvalidSessionStateException, thrown if the session is unavailable or has expired.

DeleteShippingAddressIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

DeleteShippingAddressIP

Description

Deletes a ShippingAddress from the ShippingAddressMap and creates a new CustomerValue object; then sets the ShippingAddressMap on CustomerValue and places it into the Pipeline session.

Required HTTPServletRequest Parameters

HttpRequestConstants.ADDRESS_KEY

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

Removed Pipeline
Session Attributes

None

Validation

Verifies that HttpRequestConstants.ADDRESS_KEY is not NULL.

Exceptions

InvalidInputException, thrown if HttpRequestConstants.ADDRESS_KEY is NULL.

InvalidSessionStateException, thrown if the session is unavailable or has expired.

UpdateAccountInfoIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

UpdateAccountInfoIP

Description

Processes the customer's input from the changepassword.jsp. Creates a CustomerValue object in the Pipeline session containing the new information.

Required HTTPServletRequest Parameters

HttpRequestConstants.PASSWORD

HttpRequestConstants.NEW_PASSWORD

HttpRequestConstants.CONFIRM_PASSWORD

Required Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

PipelineSessionConstants.PASSWORD


Removed Pipeline
Session Attributes

None

Validation

Validates the current password and verifies that the required fields contain values.

Exceptions

InvalidInputException, thrown when the current password is incorrect, when the required fields do not contain values, or if the new password and confirm password values do not match.

ProcessingException, thrown in the case of a configuration error.

UpdateBasicInfoIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

UpdateBasicInfoIP

Description

Processes the customer's input from the editprofile.jsp. Creates a CustomerValue object in the Pipeline session containing the new information.

Required HTTPServletRequest Parameters

HttpRequestConstants.CUSTOMER_FIRST_NAME

HttpRequestConstants.CUSTOMER_MIDDLE_NAME

HttpRequestConstants.CUSTOMER_LAST_NAME

HttpRequestConstants.CUSTOMER_ADDRESS1

HttpRequestConstants.CUSTOMER_ADDRESS2

HttpRequestConstants.CUSTOMER_CITY

HttpRequestConstants.CUSTOMER_STATE

HttpRequestConstants.CUSTOMER_ZIPCODE

HttpRequestConstants.CUSTOMER_COUNTRY

HttpRequestConstants.CUSTOMER_HOME_PHONE

HttpRequestConstants.CUSTOMER_BUSINESS_PHONE

HttpRequestConstants.CUSTOMER_EMAIL

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

Removed Pipeline
Session Attributes

None

Validation

Verifies that the required fields contain values.

Exceptions

InvalidInputException, thrown if the required fields do not contain values.

ProcessingException, thrown if the required Pipeline session attributes are not available.

UpdatePaymentInfoIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

UpdatePaymentInfoIP

Description

Processes the customer's input from profilenewcc.jsp and profileeditcc.jsp. Creates a CustomerValue object in the Pipeline session containing the new information.

Required HTTPServletRequest Parameters

HttpRequestConstants.CUSTOMER_CREDITCARD_TYPE

HttpRequestConstants.CUSTOMER_CREDITCARD_HOLDER

HttpRequestConstants.CUSTOMER_CREDITCARD_NUMBER

HttpRequestConstants.CUSTOMER_CREDITCARD_DISPLAY_NUMBER

HttpRequestConstants.CUSTOMER_CREDITCARD_MONTH

HttpRequestConstants.CUSTOMER_CREDITCARD_YEAR

HttpRequestConstants.CUSTOMER_CREDITCARD_ADDRESS1

HttpRequestConstants.CUSTOMER_CREDITCARD_ADDRESS2

HttpRequestConstants.CUSTOMER_CREDITCARD_CITY

HttpRequestConstants.CUSTOMER_CREDITCARD_STATE

HttpRequestConstants.CUSTOMER_CREDITCARD_ZIPCODE

HttpRequestConstants.CUSTOMER_CREDITCARD_COUNTRY

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

PipelineSessionConstants.CREDITCARD_KEY

Removed Pipeline
Session Attributes

None

Validation

Verifies that the required fields contain values, and verifies that the length of the credit card number is not less than 16 digits (15 digits for AMEX).

Exceptions

InvalidInputException, thrown if the required fields do not contain values or the credit card number is less than the minimum required for the type.

InvalidSessionStateException, thrown when the session is unavailable or has expired.

UpdateShippingInfoIP

Class Name

com.beasys.commerce.ebusiness.customer.webflow.

UpdateShippingInfoIP

Description

Processes the customer's input from the profileeditaddress.jsp. Creates a CustomerValue object in the Pipeline session containing the new information.

Required HTTPServletRequest Parameters

HttpRequestConstants.CUSTOMER_SHIPPING_ADDRESS1

HttpRequestConstants.CUSTOMER_SHIPPING_ADDRESS2

HttpRequestConstants.CUSTOMER_SHIPPING_CITY

HttpRequestConstants.CUSTOMER_SHIPPING_STATE

HttpRequestConstants.CUSTOMER_SHIPPING_ZIPCODE

HttpRequestConstants.CUSTOMER_SHIPPING_COUNTRY

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

Removed Pipeline
Session Attributes

None

Validation

Verifies that the required fields contain values.

Exceptions

InvalidInputException, thrown when the required fields do not contain values.

InvalidSessionStateException, thrown if the session is unavailable or is expired.

 


Pipeline Components

This section provides a brief description of each Pipeline component associated with the Customer Profile Services JSP template(s).

Note: Some Pipeline components extend other, base Pipeline components. For more information on the base classes, see the Javadoc.

UpdateBasicInfoPC

Class Name

com.beasys.commerce.ebusiness.customer.pipeline.
UpdateBasicInfoPC

Description

Updates the Customer object for changes made by UpdateBasicInfoIP. This Pipeline component must stay in sync with the the UpdateBasicInfoIP input processor.

Required Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java class

JNDI Name

None

Exceptions

PipelineFatalException, thrown when the Pipeline component is not able to set the customer's properties.

UpdatePaymentInfoPC

Class Name

com.beasys.commerce.ebusiness.customer.pipeline.
UpdatePaymentInfoPC

Description

Updates the Customer object for changes made by UpdatePaymentInfoIP. This Pipeline component must stay in sync with the the UpdatePaymentInfoIP input processor.

Required Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java class

JNDI Name

None

Exceptions

PipelineFatalException, thrown when the Pipeline component is not able to set the customer's properties.

UpdateShippingInfoPC

Class Name

com.beasys.commerce.ebusiness.customer.pipeline.
UpdateShippingInfoPC

Description

Updates the Customer object for changes made by UpdateShippingInfoIP. This Pipeline component must stay in sync with the the UpdateShippingInfoIP input processor.

Required Pipeline
Session Attributes

None

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java class

JNDI Name

None

Exceptions

PipelineFatalException, thrown when the Pipeline component is not able to set the customer's properties.

UpdatePasswordPC

Class Name

com.beasys.commerce.ebusiness.customer.pipeline.
UpdatePasswordPC

Description

Retrieves the USER_NAME and PASSWORD from the Pipeline session and updates the password for the user.

Required Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

PipelineSessionConstants.PASSWORD

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

PipelineSessionConstants.PASSWORD

Type

Java class

JNDI Name

None

Exceptions

PipelineFatalException, thrown when the Pipeline component is not able to set the customer's properties.