Adding or customizing a portlet using the MVCPortlet class

To add a portlet to the WebSphere Commerce integration with WebSphere Portal Server.

Procedure

  1. Add a portlet using the directions in Creating, adding, removing, or editing portlets. Make sure you select "Empty portlet" as portlet class to avoid having configuration information generated.
  2. Modify the portlet deployment descriptor.

    The following parameters must be specialized when you configure the portlet deployment descriptor:

    Mandatory initialization parameters
    Name Description
    wc.config.class

    The configurator class for MVC portlet. For example:

    com.ibm.commerce.foundation.client.portal.configurations.

    MVCPortletConfiguration

    wc.config.files

    The list of MVC configuration files; order of files is important, and using LIFO method for overriding existing definitions; these configuration files must be placed under the WEB-INF/config directory of this portlet WAR. For example:

    com.ibm.commerce.foundation/

    portlet-config.xml

    wps.markup

    The markup format to be used for this portlet. HTML is the only format that has been tested and supported on the sample. WML can be used, but it is not currently supported. For example:

    html
    wps.markup.root.html

    The root directory of HTML markup JSP templates. For example:

    jsp/html
    wps.markup.root.wml

    The root directory of WML markup JSP templates. For example:

    jsp/wml
    Supported optional preference settings
    Name Description
    .ExternalContentURLReference

    JNDI name for use to lookup the location (URL) prefix to static asset files such as images.

    The default value is url/com/ibm/commerce/foundation/client/portal/ExternalContent
    .ContextDefault-storeId

    If storeId is not given in the context, this is the default storeId to be used.

    The default value is 0
    .ContextDefault-langId

    If langId is not given in the context, this is the default langId to be used.

    The default value is -1
  3. If your WebSphere Portal Server is running, restart it.
    Note: Portlet preferences can be used to initialize a business context object at runtime to build the basic set of WebSphere Commerce business context for use with the client library. When building up the initial business context object, the context plug-in will search for any portlet preference name that starts with ".ContextDefault-" and use the string after that prefix as the name of the context name. The value of this context will be the actual value set for this preference name. For example, if .ContextDefault-storeId is the name of the context default and its value is 10001, then the context name will be storeId and the context value will be 10001.