Changing a JSF portlet page without a JSF action

You can change a page in a Faces portlet using a Faces action outcome and the navigation rules.

If you want to change a page without using a Faces action, you can set a JSP file path to the one of the following session attributes:

Table 1. File Paths for JSP Session Attributes
Session Attribute Name Description
com.ibm.faces.portlet.page.view The JSP file path for the View mode.
com.ibm.faces.portlet.page.edit The JSP file path for the Edit mode.
com.ibm.faces.portlet.page.help The JSP file path for the Help mode.
com.ibm.faces.portlet.page.config The JSP file path for the Configure mode.
For example, you can create a subclass of your Faces portlet and set the session attribute in the doView() method to change the page in some conditions:
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
		if (...) {
			request.getPortletSession().setAttribute("com.ibm.faces.portlet.page.view", "/MyPage.jsp");
		}

		super.doView(request, response);
	}

Note that the session attributes are only effective before the Faces lifecycle is started by the Faces portlet's methods, such as processAction(), or actionPerformed(), or doView(), etc. Once the Faces lifecycle starts and the Faces UI component tree is created, the session attributes are not read by the Faces portlet.

Related concepts
Dynamic data using Faces components
Creating Faces portlets and projects
Related tasks
Creating Faces portlet JSP files
Adding and updating Faces portlet modes for existing IBM portlets
Adding and updating Faces portlet modes for existing JSR 168 portlets
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.