Representing view implementations: action-mappings and global-forwards

Describing device-specific and store-specific view implementations, accomplished in earlier versions of WebSphere Commerce using the VIEWREG database table, is accomplished in the WebSphere Commerce Web application with a combination of action-mappings and global-forwards elements.

About this task

Consider the four associations represented in the following table:

View name Device format ID Store ID View command interface View command implementation class Properties HTTPS Credentials Accepted
AddressBookForm -1 0 com.ibm.commerce.command.ForwardViewCommand com.ibm.commerce.command.HttpForwardViewCommandImpl docname= Address-BookForm.jsp 0 NULL
AddressBookForm -1 201 com.ibm.commerce. command.ForwardViewCommand com.ibm.commerce.command.HttpForwardViewCommandImpl docname=UserArea/AccountSection/AddressbookSubsection/AddressBookForm.jsp 1 P
GenericPassword-ErrorView -1 0 com.ibm.commerce.command.ForwardViewCommand com.ibm.commerce.command.HttpForwardViewCommandImpl docname=Generic-Application-Error.jsp&storedir=no 0 NULL
CompleteOrderView -3 201 com.ibm.commerce.messaging.viewcommands. MessagingViewCommand com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl docname=CompleteOrder.jsp 0 NULL
Where:
Device format ID
The identifier of the device to which the view will be sent. The default device format is -1, which represents an HTTP Web browser.
Store ID
The store reference number for this URI or 0 to mean any store.
Properties
Name-value pairs used by this view, in the form of an HTTP request query string.
HTTPS
The value of 1 indicates that the request was expected to be received on a secure channel (HTTPS) and a redirect to the SSL port will be issued if it has been received on an insecure channel (HTTP).
Credentials Accepted
The value of P indicates that partially authenticated users are entitled to access this resource.
The following configuration fragment describes the first three associations:

<global-forwards>
  <forward name="AddressBookForm" path="/AddressBookForm.jsp"/>
  <forward className="com.ibm.commerce.struts.ECActionForward" name="AddressBookForm/201" 
    path="/UserArea/AccountSection/AddressbookSubsection/AddressBookForm.jsp">
    <set-property property="resourceClassName" value="com.ibm.commerce.command.HttpForwardViewCommandImpl" />
  </forward>
  <forward className="com.ibm.commerce.struts.ECActionForward" name="GenericPasswordErrorView" 
    path="/GenericApplicationError.jsp">
    <set-property property="properties" value="storeDir=no" />
    <set-property property="resourceClassName" value="com.ibm.commerce.command.HttpForwardViewCommandImpl" />
  </forward>
</global-forwards>
<action-mappings type="com.ibm.commerce.struts.ECActionMapping">         
  <action path="/AddressBookForm" type="com.ibm.commerce.struts.BaseAction">
    <set-property property="https" value="0:0,201:1" />
    <set-property property="credentialsAccepted" value="201:P" />
  </action>
  <action path="/GenericPasswordErrorView" type="com.ibm.commerce.struts.BaseAction" />
</action-mappings>
Notes:
  • The value of the className attribute of the forward elements.
  • The syntax of the name attribute of the forward elements: a docname/ storeID pair, whose second constituent defaults to 0.
  • The use of the resourceClassName property to specify the view command implementation class, whose value defaults to com.ibm.commerce.command.HttpForwardViewCommandImpl.
  • You can also set the authenticate property for views, with the same syntax and semantics as for URLs (described in the preceding section).
  • The final row of the preceding table represents a messaging view, which is an example of a view that is not intended to be rendered by a browser and requires variant syntax to specify the device type as well as special properties to specify the implementation for generating the response:
    
    <global-forwards>
      <forward className="com.ibm.commerce.struts.ECActionForward" name="CompleteOrderView/201/-3" path="/AuctionArea/Messages/CompleteOrder.jsp">
        <set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
        <set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
      </forward>
    </global-forward>
    <action-mappings type="com.ibm.commerce.struts.ECActionMapping">         
      <action path="/CompleteOrderView" type="com.ibm.commerce.struts.BaseAction" />
    </action-mapping>
    
  • The extension to the syntax of the name attribute of the forward element: a docname/ storeID / deviceFormatID triplet, whose third constituent defaults to -1.
  • To identify the correct values for the messaging composition service refer to Creating an outbound message.
  • The use of the implClassName property to specify the view command implementation class and of the interfaceName property to specify the view command interface. Only use this property to define access control policies based on view implementations, it is provided for compatibility with previous versions of WebSphere Commerce.