Sun GlassFish Web Space Server 10.0 Developer's Guide

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 Sun GlassFish Web Space Server 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 Sun GlassFish Web Space Server or OpenPortal Portlet Container.