Creating Faces portlet JSP files
Before creating a Faces portlet JSP file, have a portlet project created in your workspace.
You will create additional Faces portlet JSP files to add forms and other types of pages to your portlet application. To create a Faces portlet JSP file:
- From within the Project Explorer, right-click on the name of your portlet project that resides in the Dynamic Web Projects folder; then select New > Faces JSP file. The New Faces JSP wizard will open.
- Specify the appropriate folder for the file. This field may default to the portletName/WebContent folder.
- Type the name of the new JSP file.
- The Markup Language value should be HTML, because it is the only valid option.
- Do not select Create as JSP Fragment.
- Portlet is pre-selected in the Model field, and provides standard portlet JSP code generation. If you want to enable the Faces Clients Components, which support pages that contain both data and controls, select Portlet with client-side data caching from the Model drop-down list. See Faces Client Component and Adding Faces Client Components to a Faces JSP, along with related topics, for more details about using Faces Clients Components.
- Optionally, select the Configure advanced options check box. If you prefer not to configure additional options, click Finish to create the file.
- Click Next.
- The following default JavaServer Faces tag library URI should already be included in the Tag Libraries page: http://java.sun.com/jsf/core, and will be added to the generated JSP file. In addition, the /WEB-INF/tld/portlet.tld portlet tag library URI will also be added when the JSP file is generated. Click the Add button to locate a TLD file or a JAR file that contains a TLD file to add tag libraries from a variety of sources.
- Click Next.
- Supply any of the encoding, content type, and document type information that you would typically provide for a JSP file. The Style Sheet option should be disabled for portlets. The Document Type value that you select specifies an implicit document type, which is used for content assist, the Properties view, and other editing contexts, when no DOCTYPE declaration is specified in the JSP file. Click Next.
- 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 are disabled. Click Next.
- The Set as Initial Page page enables you to create this page as the initial page for the mode that you specify.
- Click Finish. The JSP file, with appropriate markup, is created and automatically opened in the editing pane.
Related concepts
Dynamic data using Faces components
JavaServer Faces portlet applications
Markup languages
Related tasks
Creating Faces portlet projects
Creating Faces portlets
Creating Faces applications - overview
Related reference
Faces components reference
Attributes for Faces components