Creating Struts portlet projects

 

+

Search Tips   |   Advanced Search

 

Whether you prefer to create Struts portlet resources based on the JSR 168 portlet API or the IBM portlet API, you can use the Portlet project wizard to create the Struts portlet project.

A Struts-enabled portlet and a Web diagram file, by default, will be added in the process of creating the project. The wizard automatically generates a Struts portlet configuration file and the necessary updates to the web.xml and portlet.xml files, and adds all of the JAR files to the project, in the directory structure that is required.

To enable Struts portlets use the Portlet Project wizard and have a portlet type of "Struts" selected, or use a Portlet wizard to add a struts portlet to an existing portlet project.

If you add Struts Portlet facets through the Project Facet page under project properties, only the runtimes will be added to your project. This means the additional configuration needed for the portlet.xml and web.xml will not be available.

To create a Struts portlet project:

  1. Select...

    File | New | Project

    In the New Project wizard, select

    Portal | Portlet Project | Next

    The New Portlet Project wizard opens.

  2. Provide values, as appropriate, for the following fields:

    Project name

    Name for the new portlet project.

    Project content

    The location in the file system where the project will be created. Accept the default workspace, or change the file system location by using Browse.

    Target runtime

    Select the appropriate WebSphere® Portal version for your portlet project. Struts portlet is available for WebSphere Portal ServerV6.0 target runtimes. The SPF version will be the one distributed for WebSphere Portal server V6.0, .

    Struts portlets are not supported on the WAS runtimes.

    Add module to an EAR project

    Select this check box if you intend to deploy the portlet.

    EAR project

    Name of an enterprise application project (EAR project) that the portlet project should be associated with for purposes of deployment. The information used to deploy the portlet project to WebSphere Portal in the test environment will be added in this project. All portlet applications associated with a single EAR project will run on a single session at the test environment. You may separate portlet applications into multiple EAR projects. You should use the same EAR project for other projects that are related.

    Portlet API

    Select either the JSR 168 or the IBM portlet API.

    Create a portlet

    To create a portlet with this project, check the box. Specify a name for the portlet and choose Struts for the portlet type

    Show advanced options

    Check this box to access facet and runtime options using this wizard.

    If you want accept the defaults associated with a portlet project, click Next, then click Finish.

    If you prefer to customize more project options, click Next.

  3. In the Portlet Settings page, define the following:

    Content types and modes

    Specify the content type and its modes.

    • Struts portlets always support html markup. You can add Compact HTML (chtml) or WML 1.3 (wml) markup support to the project. These markups are not currently supported by Rational® Software Delivery Platform.

    • Select the appropriate check boxes for any additional modes that you want to enable for the portlet.

      View mode is always provided by default.

    Code generation options

    Generate a custom portlet class is not available for Struts, as the tool does not support creating additional subclasses of a Struts portlet.

    • Package prefix - a combination of the default package naming preference plus the project name.

    • Class prefix - a combination of the portlet-name suffixed by "Portlet".

    • Super class - a base class for the portlet class being generated

    Locale specific information

    Choose the default, or click Add to create a new locale.

    Click Next.

  4. Update any Struts portlet-specific settings in the Struts Portlet Settings page. By default, the wizard will create resource bundles. The Java package name default is built using the project name that you specified.

  5. Click Finish. A new portlet project is created with a Struts portlet definition in web.xml and portlet.xml.

 

Related concepts

Creating Struts portlets and projects

Struts portlet applications

Struts Portlet Framework

 

Related reference

Differences between Struts 1.1 and SPF tag library classes