MyEclipse Logo
 

Supplemental WebSphere Portal 6.0 / 6.1 Portlet APIs

  download the latest MyEclipse version

help and support
 

1. Portlet JSR 168 API support with MyEclipse Blue Edition

MyEclipse Blue Edition supports development JSR 168 Portlets by providing a JSR 168 API library container that is added to projects by the "Add Portlets Capabilities..." wizard. 

This library container only contains exactly the JSR 168 reference APIs and does not contain and additional WebSphere JSR 168 Portlet APIs, like the JSR 168 Cooperative or the JSR 168 Struts APIs. 

The rest of this article will describe how to add support for one additional JSR 168 Portlet APIs for WebSphere Portal 6.0, namely the JSR 168 Cooperative API.


 

2. Enabling additional JSR 168 API support for WebSphere Portal 6.0

In this section we're going to import a sample from the WebSphere Portal 6.0 sample applications that uses the JSR 168 Portlet Cooperative API.  This example can be used as a guideline for how to enable other additional APIs for WebSphere Portal 6.x development.  In this process you will see that at first the JSR 168 Coop portlet code does not compile but after we make our changes its compiles and deploys cleanly to the WebSphere Portal 6.x.

  1. First ensure that you have a properly configured WebSphere Portal 6.0 connector.  If you don't you can read the following document to learn how to properly configure the portal server in MyEclipse Blue.

    WebSphere Portal 6.0 Tutorial

  2. Also in that tutorial it shows you how to configure a MyEclipse Web project to have support for JSR 168 Portlets that can be deployed to WebSphere Portal 6.0.  For this example we are going to try to use a sample project provided by IBM for using the JSR 168 Cooperative Portlets API.  Click the link below to download the project and you can import in into eclipse using File > Import > Existing Projects... > Point to downloaded zip file

    Download pbjsrshipexample.zip

    Once you import the project into MyEclipse Blue Edition it will have compile errors because by default the MyEclipse JSR 168 library container does not support the JSR 168 Coop Portlets API from WebSphere.



    If you look at the errors closer you will find that the problem is that project's classpath doesn't contain the following APIs.

    com.ibm.portal.portlet.service.*
    com.ibm.portal.propertybroker.service.*


  3. Now we need to modify the project's classpath to add these APIs.  The best way to accomplish this is to modify the MyEclipse Blue provided JSR 168 API library container.



    This library container can be edited in the following location:
    Window > Preferences > MyEclipse Blue Edition > Project Capabilities > Portlets (JSR 168)



  4. By default the JSR 168 API container only contains javax.portlet.* APIs and the Portlet 1.0 taglib.  We need to modify it so that it will also include the 2 missing APIs.  To do this we must look through the shared libraries that are available in the WebSphere Portal 6.0 installation:

    <WEBSPHERE_PORTAL_HOME>/shared/app

    This directory contains jars that are available to any portlet at runtime when deployed into WebSphere Portal. The following to jars contain the libraries we need:

    <WEBSPHERE_PORTAL_HOME >/shared/app/wp.pe.api.standard.jar
    <WEBSPHERE_PORTAL_HOME >/shared/app/wp.propertybroker.standard.api.jar

  5. In the Portlets (JSR 168) Preference page, select the " Add JAR/ZIP" button and navigate to your WebSphere Portal home directory and select those 2 jars, listed above wp.pe.api.standard.jar, wp.propertybroker.standard.api.jar



    When you get finished you will see those jars listed along side the default JSR 168 jars.



  6. Now choose OK and your project should recompile and should have no errors.  Now it can be deployed to your WebSphere Portal 6.0 and operate correctly.



    From the Portal home we can add our new JSR 168 Co-op portlets to our home page to demostrate they are working correctly:





3. Conclusion

This article has showed how to modify the MyEclipse Blue JSR 168 Portlets library container to contain some WebSphere Portal 6.0 specific libraries that will be available at compile time in your project. 

These libraries are also available during runtime when deployed within the WebSphere Portal 6.0 server.  This process can be generalized to add in support for any additional APIs like Struts framework as long as the appropriate libraries from your WebSphere Portal shared/app directory are added to your project's build path.