Developing > Persistence layer > WebSphere Commerce integration with WebSphere Portal > Customizing WebSphere Commerce Portal integration
Using the provided WebSphere Commerce MVCPortlet class (MVC style)
The WebSphere Commerce Portlet, MVCPortlet, is a generic implementation of the MVC pattern. It allows you to set up one or more portlets, each with its own configuration, to call various WebSphere Commerce services. This programming pattern greatly reduces code redundancy as well as maintaining a consistent behavior across all WebSphere Commerce portlet actions.
There are several customizable assets, described in the following sections:
Portlet Action and Render Configuration
Each portlet can have one or more MVC configuration files and they are loaded in the order that is specified in the portlet deployment descriptor. In each MVC configuration file, an action definition is required to define how the request can be mapped out into a WebSphere Commerce service request. A render definition might also be required, depending on the nature of the request. See the Portlet configuration file syntax topic for more information about the portlet action and render configuration.
Portlet JSP file
The Portlet JSP file is a view template for displaying business data and getting inputs from the portal user. These JSP files contain markup tags that provide a consistent, clean, and complete user interface. The portal page is displayed using skins and themes defined by the portal designer or administrator. For portlets to appear integrated with an organization's portal or user's customized portal, they should generate markup that invokes the generic style classes for portlets, rather than using tags or attributes to specify colors, fonts, or other visual elements.
Portlets are allowed to render only markup fragments, which are then assembled by the portlet framework for a complete page. Portlet output should contain complete, well-structured, and valid markup fragments. This helps to prevent the portlet's HTML code, for example, from corrupting the portal's aggregated HTML code.
See the Markup guidelines topic in the WebSphere Portal Server Information Center for more information about the JSP coding guidelines for JSR 168 portlet API.
WebSphere Commerce foundation tag library
A <wcf:getData> action tag is provided as part of the WebSphere Commerce foundation tag library. This tag retrieves populated service data objects from the WebSphere Commerce services. See the Tag: getData topic for more information.
WebSphere Commerce services
WebSphere Commerce provides services that have been created using existing WebSphere Commerce controller commands and data beans, fronted by a component facade interface. These services can be used on the portlet using the WebSphere Commerce foundation tag library. For more information, see the WebSphere Commerce services topic.
Client Library
Each WebSphere Commerce service module provides a client library that is responsible for building the messages to be sent to the WebSphere Commerce services. Upon each invocation, business objects, such as BusinessContextType and AuthenticationCallbackHandler, are passed to the interface so that it can hand over specific information to the service binding layer.
For more information, see the Client library for WebSphere Commerce services topic.
Add or customizing a portlet using the MVCPortlet class
To add a portlet to the WebSphere Commerce integration with WebSphere Portal Server.
Use WebSphere Commerce services in portlets
There are two ways to use WebSphere Commerce services from a WebSphere Commerce portlet:
WebSphere Commerce Portal integration event handlers
In WebSphere Commerce portlet programming, you are advised to use generic event handlers.
Populating data on a portlet JSP file using the WebSphere Commerce foundation tag library
The WebSphere Commerce foundation tag library provides a JSP tag, <wcf:getData>, which allows you to retrieve service data objects from any SOA or SOI WebSphere Commerce service. It associates the service data objects with a newly declared scripting variable with a given id. The specified id associates the SDO objects with a specified scope. Unless otherwise specified, the Java object created is an instance of java.util.List that contains the list of service data objects.
Define references to static content in an MVCPortlet JSP file
According to Portal's portlet programming best practices, all static content asset files, such as images and static HTML, should be included into the portlet application for ease of installation and deployment. However, the MVCPortlet also allows external references to these static contents using a URL defined in the URL provider, with a default JNDI name url/com/ibm/commerce/foundation/client/portal/ExternalContent. However, this JNDI name can be overriden by defining a portlet preference, .ExternalContentURLReference.
Create cooperative portlets
Creating cooperative portlets consists of three main steps.
Last updated: 25 November 2009