Developing > Persistence layer > WebSphere Commerce integration with WebSphere Portal > Customizing WebSphere Commerce Portal integration > Use the provided WebSphere Commerce MVCPortlet class (MVC style) > Using WebSphere Commerce services in portlets
MVC portlet configuration file syntax
The portlet-config.xml file contains action tags, render tags, and plug-in tags.
Action tag
- name
- The action name, which is the unique identifier for the action definition. Must be unique across the entire file.
- className
The fully qualified handler implementation. Parameters can be passed to this handler using the set-property tag.
A generic portlet action request handler, com.ibm.commerce.foundation.client.portal.handlers.MVCPortletActionHandler, has been provided to simplify the task of calling the WebSphere Commerce service client library, which is the recommended programming pattern. Several mandatory properties must be set:
- clientLibrary
- The fully qualified name of the client library interface.
- clientMethod
- The name of the client library method.
- renderName
- The name of the default render for this action, if one is not specified.
- session
- The session flag defines whether the action request is required to be executed in a stateful session environment. If set to true, a session will be created if none exists. The default value is false.
An example of the action tag is seen in the following example:
<action className="com.ibm.commerce.foundation.client.portal.handlers.MVCPortletActionHandler" name="ChangePersonalInformation"> <set-property name="clientLibrary" value="com.ibm.commerce.member.facade.client.MemberFacadeClient"/> <set-property name="clientMethod" value="updatePerson" /> <set-property name="renderName" value="ChangePersonalInformationDisplay" /> <set-property name="session" value="true" /> </action>
Render tag
- name
- The render name, which is the unique identifier for the render definition. Must be unique across the entire file.
- className
- The fully qualified handler implementation. Parameters can be passed to this handler using the set-property tag.
A generic portlet render request handler, com.ibm.commerce.foundation.client.portal.handlers.MVCPortletRenderHandler, has been provided to simplify the task of forwarding to a JSP file.
Local forward definitions can be defined for each portlet mode:
- mode
- The portlet mode. Possible values are:
- view
- edit
- help
- config
- path
- The relative location of the JSP file.
If any of the above mode render definitions is not declared, then the corresponding portlet mode fallback definition is used. A default render definition must be declared with "default" name. It must have one definition for each supported portlet mode.
From the portlet action request, if a render name (a parameter called renderName) is passed in, then this name is used for looking up the render definition instead. Otherwise, the renderName defined in the action definition is used as the render name for the response page.
Other optional properties:
- session
- (Optional) The session flag defines whether the action request is required to be executed in a stateful session environment. If set to true, a session will be created if none exists. The default value is false.
An example of the render tag is seen in the following XML sample:
<render className="com.ibm.commerce.foundation.client.portal.handlers.MVCPortletRenderHandler" name="ChangePersonalInformationDisplay"> <forward mode="view" path="/member/ChangePersonalInformationDisplay.jsp" /> <set-property name="session" value="true" /> </render>
Plug-in tag
- className
- The fully qualified plug-in extension implementation. Parameters can be passed to this handler using the set-property tag.
- type
- The plug-in type. The supported types are:
- context
- credential
- store
Three plug-in extension modules are shipped with the WebSphere Commerce Portlet:
- Context Service Plug-in Extension
- A generic business context service plug-in extension, com.ibm.commerce.foundation.client.portal.services.MVCPortletContextService, which has been provided to aggregate tasks for generating the business context object for use in the client library.
- Credential Plug-in Extension
- A generic credential plug-in extension, com.ibm.commerce.foundation.client.portal.services.MVCPortletCredentialService, which has been provided to aggregate tasks for generating the Commerce Identity token for use in the client library.
- Store Plug-in Extension
- A generic store plug-in extension, com.ibm.commerce.foundation.client.portal.services.MVCPortletStoreService, which has been provided to present store services, such as resolving the store directory and the associated asset store.
An example of the plug-in tag is seen in the following XML sample:
<portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletContextService" type="context"> <set-property name="LocaleMap" value="language.properties" /> </portlet-plug-in> <portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletCredentialService" type="credential"> </portlet-plug-in> <portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletExtendedSiteService" type="store"> <set-property name="AssetStoreMap" value="asset-store.properties" /> <set-property name="StoreDirectoryMap" value="store-directory.properties" /> </portlet-plug-in>
Related concepts
WebSphere Commerce integration with WebSphere Portal
WebSphere Commerce Portal integration event handlers
Related tasks
Last updated: 25 November 2009