Associating JSP file names with views

The WebSphere Commerce Server uses view commands to compose a view as a response to a request. WebSphere Commerce Server provides the following view commands:

HttpForwardViewCommandImpl
This view command forwards the view request to a JSP file.

Use the HttpForwardViewCommandImpl view command to render JSP files directly. For example, in the diagram illustrating the URLs used in Consumer direct store, in order to display the Help page (HelpDisplay.jsp), the HelpView is registered in the view registry and associated with the HelpDisplay.jsp and the HttpForwardViewCommandImplcommand. This is demonstrated in the following example:

<viewreg
viewname="HelpView"
devicefmt_id="-1"
storeent_id="@storeent_id_1"
interfacename="com.ibm.commerce.command.ForwardViewCommand"
classname="com.ibm.commerce.command.HttpForwardViewCommandImpl"
properties="docname=HelpDisplay.jsp"
internal="0"
https="0"
/>

Note that the fully qualified class name for the interface and the implementation class is used.

Use the HttpForwardViewCommandImpl view command to render views returned from a display command. A display command reads data from the database, but does not change it. For example, in the diagram illustrating the URLs used in Consumer direct store, the OrderItemDisplay command returns the OrderItemDisplayViewShiptoAssoc view. When this view was registered in the view registry, the OrderItemDisplay.jsp and the HttpForwardViewCommandImpl were associated with it. This is demonstrated in the following example:

<viewreg
viewname="OrderItemDisplayViewShiptoAssoc"
devicefmt_id="-1"
storeent_id="@storeent_id_1"
interfacename="com.ibm.commerce.command.ForwardViewCommand"
classname="com.ibm.commerce.command.HttpForwardViewCommandImpl"
properties="docname=OrderItemDisplay.jsp"
internal="0"
https="0"
/>

You must associate a JSP filename for every view associated with every display command (for example, OrderItemDisplay) you use.

Note: ProductDisplay and CategoryDisplay obtain the associated JSP filenames from the catalog data (see DISPENTREL database table) rather than the view registry.

HttpRedirectViewCommandImpl
This view command redirects the view request to another URL.

Use the HttpRedirectViewCommandImpl view command to render views returned from a command that changes the database. To use the redirect view, specify the view name using the &URL= parameter on the URL. For example, when you add address information in the Consumer direct store AddressForm and click Submit, it invokes the AddressAdd command. The URL used to invoke the AddressAdd command specifies AddressBookForm as the view using the &URL= parameter. This results in a redirect to the AddressBookForm view. When the AddressBookForm view was registered in the view registry, the AddressBookForm.jsp and the HttpForwardViewCommandImpl were associated with it.

You must use the URL=parameter technique for all non-display commands. Non-display commands are commands that cause changes to the data in the database.

HttpDirectViewCommandImpl
This type of view command sends the response view directly to the client. It does not call a JSP file. Direct views allow controller commands to produce the output response (rather than the view command).

Feedback