Project WebSynergy Milestone 4 Developer's Guide

Developing Portlets Using Eclipse Portal Pack in Project WebSynergy

The Eclipse Portal Pack provides a set of plugins that help you to develop JSR 168/286 Portlets and deploy them on supported portlet containers.

There are three plugins available in the Eclipse Portal Pack.

Installing the Eclipse Portal Pack

You need to install the Eclipse Portal Pack to use the plugins and develop and deploy portlets.

ProcedureTo Install the Eclipse Portal Pack

  1. Download Eclipse Portal Pack from the Eclipse Portal Pack download page.

  2. Unzip the Eclipse Portal Pack.

  3. Copy the .jar files to the ECLIPSE_HOME\plugins directory.

  4. (Optional) — Restart Eclipse, only if it is running while you copy the .jar files.

Using the Eclipse Portal Pack

    This section explains how to use the Eclipse Portal Pack and the plugins in Project WebSynergy. You need to perform the following tasks before using the Eclipse Portal Pack.

  1. Creating Runtime and Server for Project WebSynergy

  2. Creating a Runtime and Server for OpenPortal Portlet Container 2.0

Creating a Runtime and Server for Project WebSynergy

You need to create a runtime and server for Eclipse Portal Pack in order to deploy it on Project WebSynergy.

ProcedureTo Create a Runtime and Server for Project WebSynergy

  1. On Eclipse IDE, click the Window menu and select Preferences.

    The Preferences window appears.

  2. From the left pane, click Installed Runtimes.

    The Installed Server Runtime Environments appear on the right pane.

  3. Click Add.

    The New Server Runtime window appears. In this window, you can choose the runtime environment for a newly installed server.

  4. From the available runtime types, expand Sun Microsystems Inc and select WebSynergy. Select the Also create new local server check box.

  5. Click Next.

  6. Enter the JRE name, GlassFish Home directory, and the Domain Name information for Project WebSynergy.

    These details are useful to create a runtime for Project WebSynergy.

  7. Click Next.

  8. Enter the server address, server port, and the debug port information for Project WebSynergy.

  9. Click Finish.

    The Project WebSynergy server is created.

Creating a Runtime and Server for OpenPortal Portlet Container 2.0

You need to create a runtime and server for Eclipse Portal Pack in order to deploy it on OpenPortal Portlet Container 2.0.

ProcedureTo Create a Runtime and Server for OpenPortal Portlet Container 2.0

  1. On Eclipse IDE, click the Window menu and select Preferences.

    The Preferences window appears.

  2. From the left pane, click Installed Runtimes.

    The Installed Server Runtime Environments appear on the right pane.

  3. Click Add.

    The New Server Runtime window appears. In this window, you can choose the runtime environment for a newly installed server.

  4. From the available runtime types, expand Sun Microsystems Inc and select OpenPortal Portlet Container 2.0. Select the Also create new local server check box.

  5. Click Next.

  6. Enter the JRE name, GlassFish Home directory, and the Domain Name information for OpenPortal Portlet Container 2.0.

    These details are useful to create a runtime for OpenPortal Portlet Container 2.0.

  7. Click Next.

  8. Enter the server address, server port, and the debug port information for OpenPortal Portlet Container 2.0.

  9. Click Finish.

    The OpenPortal Portlet Container 2.0 server is created.

Creating and Deploying a Portlet

You can use the plugins in Eclipse Portal Pack to create and deploy portlets on Project WebSynergy. This section explains how to create and deploy portlets on Project WebSynergy using the Eclipse Portal Pack plugins.

ProcedureTo Create and Deploy a Portlet

  1. On Eclipse IDE, click the File menu and select New. Form New, choose Dynamic Web Project.

    The New Dynamic Web Project window appears.

  2. In the New Dynamic Web Project window, enter a name for your project, choose WebSynergy or OpenPortal Portlet Container 2.0 as project runtime, and select Portlet 1.0 or 2.0 support as the configuration.


    Note –

    If Portlet 2.0 configuration is not available in the list, you need to manually add the configuration. To do this, click Modify, select Portal Pack and click Save.


  3. Click Finish.

    A new web project is created.

  4. To add a portlet to the web project, click the File menu. From the options, select New and click Other.

    The New window to create a Java portlet appears.

  5. From the list of Wizards, expand the Portlet wizard and click Java Portlet.

  6. Click Next.

    The Create a Portlet Class window appears.

  7. Enter the details of the portlet that you want to generate.

  8. Click Finish.

    A portlet class is created and an entry about the portlet is created in the portlet.xml file.

  9. To deploy the portlet, right click on the name of the portlet, select Run As, and click Run On Server. Accept the default values.

    This action deploys the portlet web application and starts the target server, which is either WebSynergy or OpenPortal Portlet Container.