Tutorials > Portal > Portal > Call the TutorialStore service in a portlet

< Previous | Next >


Register a MVCPortlet render to use GetStore portlet JSP

In this step of the tutorial, you are going to register a new MVCPortlet render definition in the portlet configuration file. This render event uses the GetStore portlet JSP file for displaying the content returned from the TutorialStore service.


Procedure

  1. Add a new MVCPortlet configuration file for the TutorialStore portlet, and include the GetData configuration file for the TutorialStore service module. This GetData configuration file is used for defining Get expression builders for the TutorialStore service. Expression builders are used for generating Get expressions to be used on portlet JSPs, along with the getData tag, to retrieve data from any WebSphere Commerce services:

    1. Expand the MVCPortlet project to MVCPortlet\WebContent\WEB-INF\config\ext.

    2. Right-click the ext folder and select New > Other.

    3. Select General > Folder.

    4. Name the folder com.mycompany.commerce.tutorialstore.

    5. Click Finish.

    6. Right-click the newly created com.mycompany.commerce.tutorialstore folder.

    7. Select Import > General > File System.

    8. Click Next.

    9. Click Browse and navigate to the temporary folder where you unzipped the tutorial sample code.

    10. Select the get-data-config.xml and portlet-config.xml files.

    11. Click Finish.

  2. Register the new portlet configuration to the MVCPortlet.

    1. Expand the MVCPortlet project to MVCPortlet\WebContent\WEB-INF.

    2. Right-click portlet.xml and select Open. The Portlet Deployment Descriptor editor opens.

    3. Click the Portlets tab and highlight the TutorialStore portlet on the left-side.

    4. Highlight the wc.config.files and click Edit….

    5. On the right-side, scroll down to the Initialization section.

    6. Append the following information to the end of the Value property:

      ext/com.mycompany.commerce.tutorialstore/portlet-config.xml
      

      After you add the value, this <init-param> section in portlet.xml should resemble the following XML sample:

      <init-param>
       
      <name>wc.config.files</name>
       
      <value>com.ibm.commerce.foundation/portlet-config.xml,   ext/com.mycompany.commerce.tutorialstore/portlet-config.xml</value>
      </init-param>
      

    7. Save the file (Ctrl+S).

In this step of the tutorial, you have registered the MVCPortlet and added a sample GetStore portlet JSP file that will use the TutorialStore service running as part of a WebSphere Commerce Server.

< Previous | Next >


+

Search Tips   |   Advanced Search