BEA Logo BEA WebLogic Portal Release 4.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WebLogic Portal Documentation   |   Registering Customers   |   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 Registering Customers and Managing Customer services provide 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 Registering Customers and Managing Customer services contain 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.

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

viewprofile.jsp Template

The viewprofile.jsp template (shown in Figure 3-1) allows a registered customer to view his or her existing profile information. It displays the existing information in five categories: personal information, shipping addresses, credit cards, username and password, and demographic information. 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 black lines and callout text are explanations of the template components.

Figure 3-1 Annotated viewprofile.jsp Template


 

Location in the Directory Structure

You can find the viewprofile.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME\applications\wlcsApp\wlcs\
commerce\user\viewprofile.jsp
(Windows)

%PORTAL_HOME/applications/wlcsApp/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="webflow.tld" prefix="webflow" %>
<%@ 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 Guide to Building Personalized Applications documentation.

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

PORTAL_HOME\applications\wlcsApp\wlcs\
WEB-INF
(Windows)

PORTAL_HOME/applications/wlcsApp/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="java.text.DateFormat"%>

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 page is described in other sections of this document.

This template is part of the sampleapp_user namespace in the Webflow.

Note: For more information about the default Webflow, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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
Pipeline

button.updateDemograhpicInfo

No business logic required. Loads editdemographics.jsp.

button.addNewCreditCard

No business logic required. Loads profilenewcc.jsp.

button.updatePaymentInfo

No business logic required. Loads profileeditcc.jsp.

button.deletePaymentInfo

DeleteCreditCardIP

DeleteCreditCard Pipeline

button.changePassword

No business logic required. Loads changepassword.jsp.


 

Table 3-2 briefly describes each of the Pipelines from Table 3-1. For more information about individual Pipeline Components, see Pipeline Components.

Table 3-2 viewprofile.jsp Associated 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) in the session 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 User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications 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 propertySet="CustomerProperties" propertyName="contactAddress" id="contactAddressObject" />
<um:getProperty propertySet="CustomerProperties" propertyName="shippingAddressMap" id="shippingAddressMapObject" />
<um:getProperty propertySet="CustomerProperties" propertyName="creditCardsMap" id="creditCardsMapObject" />
<%
// Convert contactAddressObject and shippingAddressMapObject to the
// correct types.
Address contactAddress = (Address) contactAddressObject;
Map shippingAddressMap = (Map) shippingAddressMapObject;
Map creditCardsMap = (Map) creditCardsMapObject;

// initialize shippingAddressMap
if(shippingAddressMap == null) {
shippingAddressMap = new HashMap(); }
%>

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

<tr>
<td align="right" valign="top" width="5%"><div class="tabletext"><b>Address</b></div></td>
<td width="5"><img src="<webflow:createResourceURL resource="/commerce/images/shim.gif" />" width="5" height="5"></td>
 <td align="left"><div class="tabletext">
    <%=contactAddress.getStreet1()%><br>
    <% if(contactAddress.getStreet2().length() != 0) { %>   
    <%=contactAddress.getStreet2()%><br> <% } %>
    <%=contactAddress.getCity()%><br>
    <%=contactAddress.getState()%> &nbsp; 
    <%=contactAddress.getPostalCode()%><br>
    <%=contactAddress.getCountry()%></div>
  </td>
</tr>
.
.
.
<!-- Loop through all of the credit cards -->
<wl:repeat	set="<%=((Map)creditCardsMapObject).keySet().iterator()%>"
id="creditCard" type="String" count="100000">
<tr>
<!-- Output the credit card name -->
  <td width="55%"><div 
  class="tabletext"><b><%=creditCard%></b></div><td>
<!-- The update button -->
<%
extraParams = HttpRequestConstants.CREDITCARD_KEY + "=" + creditCard;
%>
  <td align="center">
    <a href="<webflow:createWebflowURL 
    event="button.updatePaymentInfo" namespace="sampleapp_user" 
    extraParams="<%= extraParams %>" />"><img src=
    "<webflow:createResourceURL 
    resource="/commerce/images/btn_updatecard.gif" />" 
    border="0"></a>
  </td>
.
.
.
</wl:repeat>

Notes: For more information on User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications.

The getPropertyAsString JSP tag is used to directly obtain the customer's first and last name, the customer's home and business phone numbers, the customer's e-mail address, demographic information, and username and password. 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 propertySet="CustomerProperties" propertyName="firstName" /> <um:getPropertyAsString propertySet="CustomerProperties" 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 e-mail address.

Sample Browser View

Figure 3-2 shows an annotated version of the editprofile.jsp template.The black lines and callout text are not part of the template; they are explanations of the template components.

Figure 3-2 Annotated editprofile.jsp Template


 

Location in the Directory Structure

You can find the editprofile.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME\applications\wlcsApp\wlcs\commerce\user\
editprofile.jsp
(Windows)

PORTAL_HOME/applications/wlcsApp/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="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>
<%@ taglib uri="es.tld" prefix="es" %>

Note: For more information on the WebLogic Server JSP tags or the User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications.

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

PORTAL_HOME\applications\wlcsApp\wlcs\
WEB-INF
(Windows)

PORTAL_HOME/applications/wlcsApp/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.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%@ page import="com.beasys.commerce.webflow.PipelineSessionConstants" %>
<%@ page import="java.util.*" %>

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.

This template is part of the sampleapp_user namespace in the Webflow.

Note: For more information about the default Webflow, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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 Pipeline


 

Table 3-6 briefly describes each of the Pipelines from Table 3-5. For more information about individual Pipeline Components, see Pipeline Components.


 
 

Table 3-6 editprofile.jsp Associated 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 User Management JSP tags, and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) in the session 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 User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications.

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 propertySet="CustomerProperties" 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.


 

Notes: The getPropertyAsString JSP tag is used to obtain the customer's first and last name, the customer's home and business phone numbers, the customer's e-mail address, demographic information, and username and password.

The getProperty JSP tag is used to obtain a value from the EMAIL_OPT_IN attribute. This attribute designates if the customer wants to receive promotional items via e-mail.

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 propertySet="CustomerProperties" propertyName="firstName" id="firstName" />

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/AttributesWithin editprofile.jsp Java Scriptlets

<tr>
  <um:getPropertyAsString propertySet="CustomerProperties" 
  propertyName="lastName" id="lastName" />
  <td width="26%"><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 %>><b>Last name </b></font></div>
  </td>
  <td width="74%">
  <input type="text" name="<%=HttpRequestConstants.CUSTOMER_LAST_NAME%>" value="<%=customerLastName%>" maxlength="30"> * </td>
</tr>
<tr>
  <td width="26%"><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 %>><b>Street                 address</b></font></div>
  </td>
  <td width="74%">
  <input type="text" name="<%=HttpRequestConstants.CUSTOMER_ADDRESS1%>" value="<%=customerAddress1%>" maxlength="30">*</td>
</tr>

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.

"namespace"

Hidden

The namespace for the JSP; sampleapp_user in this JSP.

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 e-mail address.

HttpRequestConstants.
CUSTOMER_EMAIL_OPT_IN

Checkbox

Indicates that the customer wants to receive promotional materials via e-mail.


 

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 black lines and callout text are not part of the template; they are explanations of the template components.

Figure 3-3 Annotated profilenewaddress.jsp Template


 

Location in the Directory Structure

You can find the profilenewaddress.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME\applications\wlcsApp\wlcs\
commerce\user\profilenewaddress.jsp
(Windows)

PORTAL_HOME/applications/wlcsApp/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" %>

Note: For more information about the Webflow and Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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

PORTAL_HOME\applications\wlcsApp\wlcs\
WEB-INF
(Windows)

PORTAL_HOME/applications/wlcsApp/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.tags.WebFlowTagConstants" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%@ 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.

This template is part of the sampleapp_user namespace in the Webflow.

Note: For more information about the default Webflow, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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

UpdateShippingInfoIP

ProfileNewAddress Pipeline


 

Table 3-10 briefly describes each of the Pipelines from Table 3-9. For more information about individual Pipeline Components, see Pipeline Components.


 
 

Table 3-10 profilenewaddress.jsp Associated 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 imported from the newaddresstemplate.jsp file, and a description for each of these form fields are shown in Table 3-11.

Note: If a form field is imported from another template, it is indicated in the description. Form fields without import information are in the profilenewaddress.jsp template.

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.

"namespace"

Hidden

The namespace for the JSP; sampleapp_user in this JSP.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS1

Textbox

The first line in the customer's street address. Imported from newaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS2

Textbox

The second line in the customer's street address. Imported from newaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_CITY

Textbox

The city in the customer's address. Imported from newaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_STATE

Listbox

The state in the customer's address. Imported from newaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_ZIPCODE

Textbox

The zip code in the customer's address. Imported from newaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_COUNTRY

Listbox

The country in the customer's address. Imported from newaddresstemplate.inc.


 

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 black lines and callout text are not part of the template; they are explanations of the template components.

Figure 3-4 Annotated profileeditaddress.jsp Template


 

Location in Commerce services Directory Structure

You can find the profileeditaddress.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME\applications\wlcsApp\wlcs\
commerce\user\profileeditaddress.jsp
(Windows)

PORTAL_HOME/applications/wlcsApp/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 User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications. For more information about the Webflow JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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

PORTAL_HOME\applications\wlcsApp\wlcs\
WEB-INF
(Windows)

PORTAL_HOME/applications/wlcsApp/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.tags.WebFlowTagConstants" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>

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.

This template is part of the sampleapp_user namespace in the Webflow.

Note: For more information about the default Webflow, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

Included JSP Templates

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

About the Included editaddresstemplate.inc Template

The editaddresstemplate.inc 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.inc template will validate the form to ensure that all required fields contain values. If errors are detected, the editaddresstemplate.inc template will be redisplayed, with an error message at the top and the offending field labels shown in a red (as opposed to the original black) font. Previously entered correct information will still be displayed in the form.

Since the editaddresstemplate.inc 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.inc 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.inc

<tr>
  <td width="26%"> <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 width="74%">
   <input type="text" name="<%=HttpRequestConstants.CUSTOMER_SHIPPING_ADDRESS1%>" value="<%=customerShippingAddress1%>" maxlength="30">*</td>
</tr>

Notes: For more information about the getValidatedValue JSP tag, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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

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 Pipeline


 

Table 3-13 briefly describes each of the Pipelines from Table 3-12. For more information about individual Pipeline Components, see Pipeline Components.


 
 

Table 3-13 profileeditaddress.jsp Associated 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.inc 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 User Management JSP tags, and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) in the session 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 User Management JSP tags, see "Personalization Server JSP Tag Library Reference" in the Guide to Building Personalized Applications.

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 propertySet="CustomerProperties" 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. In this scenario, the scriplets are in the editaddresstemplate.inc. 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 imported from the editaddresstemplate.inc file, and a description for each of these form fields are listed in Table 3-15.

Note: If a form field is imported from another template, it is indicated in the description. Form fields without import information are in the profileeditaddress.jsp template.

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.

"namespace"

Hidden

The namespace for the JSP; sampleapp_user in this JSP.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS1

Textbox

The first line in the customer's shipping address. Imported from editaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_ADDRESS2

Textbox

The second line in the customer's shipping address. Imported from editaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_CITY

Textbox

The city in the customer's shipping address. Imported from editaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_STATE

Listbox

The state in the customer's shipping address. Imported from editaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_ZIPCODE

Textbox

The zip/postal code in the customer's shipping address. Imported from editaddresstemplate.inc.

HttpRequestConstants.
CUSTOMER_SHIPPING_COUNTRY

Listbox

The country in the customer's shipping address. Imported from editaddresstemplate.inc.


 

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 black lines and callout text are not part of the template, but explanations of the components.

Figure 3-5 Annotated profilenewcc.jsp Template


 

Location in the Directory Structure

You can find the profilenewcc.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME\applications\wlcsApp\wlcs\
commerce\user\profilenewcc.jsp
(Windows)

PORTAL_HOME/applications/wlcsApp/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 library:

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

Note: For more information about the Webflow JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

This file resides in the following directory for the Commerce services Web application:

%PORTAL_HOME\applications\wlcsApp\wlcs\
WEB-INF
(Windows)

PORTAL_HOME/applications/wlcsApp/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.tags.WebFlowTagConstants" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%@ 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.

This template is part of the sampleapp_user namespace in the Webflow.

Note: For more information about the default Webflow, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

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 Pipeline


 

Table 3-17 briefly describes each of the Pipelines from Table 3-16. For more information about individual Pipeline Components, see Pipeline Components.


 
 

Table 3-17 profilenewcc.jsp Associated 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 imported from the newcctemplate.inc file, and a description for each of these form fields are listed in Table 3-18.

Note: If a form field is imported from another template, it is indicated in the description. Form fields without import information are in the profilenewcc.jsp template.

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.

"namespace"

Hidden

The namespace for the JSP; sampleapp_user in this JSP.

HttpRequestConstants.
CUSTOMER_CREDITCARD_TYPE

Listbox

The type of the customer's credit card. Imported from newcctemplate.inc.

HttpRequestConstants.
CUSTOMER_CREDITCARD_HOLDER

Textbox

The name on the credit card. Imported from newcctemplate.inc.

HttpRequestConstants.
CUSTOMER_CREDITCARD_NUMBER

Textbox

The number of the customer's credit card. Imported from newcctemplate.inc.

HttpRequestConstants.
CUSTOMER_CREDITCARD_MONTH

Listbox

The month of the customer's credit card expiration date. Imported from newcctemplate.inc.