Creating portlet JSP files

Use the Web Page wizard to create JSP files for your portlets.

Before creating a portlet JSP file, have a portlet project created in your workspace. The Web Page wizard will create the proper JSP file based on the context of your portlet project.

You will create additional portlet JSP files to add forms and other types of pages to your portlet application. To create a portlet JSP file:

  1. From within the Project Explorer, right-click on the name of your portlet project; then select

    New | Other. In the New Wizard, expand the Web folder and select

    Web Page. Click Next. The Web Page wizard will open.

  2. Specify a name for your JSP file.

  3. Click browse to select a folder or accept the default folder for your portlet project

  4. Choose Portlet JSP as the template.

  5. If you want to configure additional options for your new page, click the

    Options button. Use the left pane of the window to supply any of the encoding, content type, and document type information that you would typically provide for a JSP file.

    • Document Markup - Supply any of the encoding content type, and document type information that you would typically provide for a JSP file.

    • J2EE - Create init() and destroy() method stubs for the JSP file by selecting the appropriate check boxes, as applicable. Registering the JSP file as a servlet in the Web deployment descriptor is not applicable to portlets, so options related to the

      Add to web.xml check box should be disabled. If they are enabled, clear the check box to disable them.

    • Style Sheets - The style sheet option is disabled for portlets.

    • Tag Libraries - Click the

      Add button to locate a TLD file or a JAR file that contains a TLD file to can add tag libraries from a variety of sources.

    After you have configured options for your JSP file, click

    Close. If you are creating a JSP for a Faces portlet then there are these additional options:

    1. For JSR 168, JSR 286, or IBM® API Faces portlets you may use the Portlet JSP tab on the Options page to specify the initial page to display.

    2. If you want the new JSP to be an initial page select the

      Set as initial page check box.

    3. Next select the associated

      Mode and

      portlet.

  6. Click Finish.

 

Related concepts

Portlet APIs

Markup languages

JavaServer Faces portlet applications

Creating Faces portlets and projects

Creating portlets and portlet projects

Web 2.0 support

 

Related tasks

Adding and updating Faces portlet modes for existing IBM portlets

Adding and updating Faces portlet modes

Portlet applications

Testing and debugging portlets

Inserting images in portlet JSP files

Changing portlet modes using a Faces action

Changing a JSF portlet page without a JSF action

Accessing portlet API objects from Faces actions and components

Creating portlet projects (IBM portlet API)

Creating portlet projects

Enabling AJAX proxy support for a portlet project