Creating Faces portlet projects

Depending on whether you prefer to create Faces portlet resources based on the IBM portlet API or the JSR 168 portlet API, choose the appropriate wizard to create the Faces portlet project.

A default Faces portlet will be added in the process of creating the project. The wizard automatically generates the related portlet configuration files, the directory structure that is required, and the necessary updates to the web.xml file.

  1. Select File > New > Portlet Project from the menu bar to create a portlet project that contains an IBM portlet. Select File > New > Portlet Project (JSR 168) from the menu bar to create a portlet project that contains a JSR 168 portlet. The wizard for the appropriate portlet project type will open.

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

    Project name

    Name for the new portlet project.

    Project location

    The location in the file system where the project will be created. You can change the file system location by using Browse.

    Create a portlet

    If you do not want to create the initial portlet definitions in the project, clear this check box. Typically, you do not need to create a portlet when you import a portlet WAR file into the project.

    To set the project's J2EE settings, or to specify the target run-time server for the project, click the Show Advanced >> button, and supply any of the following values:

    Add module to an EAR project

    Deselect this check box only if you do not intend to deploy the portlet.

    Servlet version

    Specifies the version of the Servlet and JSP specifications to be included in your portlet application. Version 2.3, the default, includes a Servlet Specification level of 2.3 and a JSP Specification level of 1.2. This default should be used to create portlet projects targeted for WebSphere Portal 5.0 or 5.1 servers.

    Note that the servlet version will determine the choice of target servers that appear in the drop-down list.

    Target server

    Select the version of WebSphere Portal that your portlet application will be installed to (either WebSphere Portal v5.0 or v5.1).

    Note: Ensure that you do not accidentally select one of the WebSphere Application Server options.

    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.

    Context root

    A context root for the portlet project. It is used as the top-level directory of your portlet application when it is deployed to WebSphere Portal in the test environment. It must not be same as the ones of other projects.

    Add support for annotated Java classes

    Ensure that this check box is selected if you plan on using model annotations to generate code in your project.

  3. Click Next.

  4. Click the Faces portlet radio button. If you want accept the defaults associated with a Faces-enabled portlet project, click Finish. If you prefer to customize the project options, click Next.

  5. The Create a Web diagram for the project check box is selected, by default so that a Web diagram (.gph) file will be created in the project. To create a portlet project that uses the JSP Standard Tag Library tags, select the JSP Standard Tag Library from the Web Project features list. For more information about how WebSphere Portal supports the use of tags from the JSP Standard Tag Library (JSTL), refer to "Using JSTL tags in the portal JSPs" in the WebSphere Portal Information Center.

  6. Update or add any general portlet settings in the Portlet Settings page. Click Next.

  7. In the Miscellaneous page, specify any additional modes that you want to enable for the portlet in the project.

    Check the Create portlet subclass check box to create a subclass of com.ibm.faces.webapp.WPFacesGenericPortlet (or com.ibm.faces.webapp.FacesGenericPortlet if the portlet uses the JSR 168 API), using the common class and package name prefixes previously defined in the wizard, and insert method stubs that call the super implementation. You can customize the portlet class as you choose.

    View mode is initially selected by default, but can be deselected. For each mode that is selected (including View) you can specify an Initial page other than the default, which is built using the project name. The Initial page field takes a path specification, relative to the Web Content folder (for example, if you type /folder/subfolder/TestView.jsp, TestView.jsp would be created in the /WebContent/folder/subfolder directory. Folders that do not currently exist will be created. The leading "/" is optional.

    From the Model drop-down list, you can select either Portlet, for a standard Faces portlet JSP file, or Portlet with client-side data caching to add the Faces Client Framework feature to the project, along with the appropriate taglib directive in the JSP file.

    The specified initial JSP files are created and the corresponding <config-param> (for an IBM portlet) or <init-param> (for a JSR 168 portlet) values are automatically generated in portlet.xml when you complete the wizard. To add additional modes after you create the portlet, the configuration parameters must be specified using the Portlet Deployment Descriptor editor.

  8. Click Finish. A new portlet project is created with the appropriate Faces portlet definition in web.xml and portlet.xml.

 

Related concepts

Creating Faces portlets and projects
Faces portlet communication

 

Related tasks

Creating Faces portlets
Adding and updating Faces portlet modes for existing IBM portlets
Adding and updating Faces portlet modes for existing JSR 168 portlets
Creating Faces portlet JSP files
Creating Faces applications - overview

Related reference
Faces components reference
Attributes for Faces components