Accessing portlet API objects from Faces actions and components
When you create a Faces portlet, a portlet variable resolver is defined in /WEB-INF/faces-config.xml. Portlet variable resolvers enable the use of value binding to the following configuration objects:
Portlet API type Configuration object Value binding JSR 168 and JSR 286 API PortletPreferences #{portletPreferences.attribute name} portletConfig #{portletConfig.attribute name} portletContext #{portletContext.attribute name} portletRenderParam #{portletRenderParam.attribute name} portletUserInfo #{portletUserInfo.attribute name} IBM® portlet API PortletApplicationSettings #{portletApplicationSettings.attribute name} portletConfig #{portletConfig.attribute name} portletContext #{portletContext.attribute name} portletUser #{portletUser.attribute name} PortletSettings #{portletSettings.attribute name} PortletData #{portletData.attribute name} Use the Page Data view of a portlet JSP file to define attributes and bind them to Faces components, as described in Accessing portlet API objects from JSP files.
PortletRequest, PortletResponse and PortletContext can be obtained through the ExternalContext method of facesContext as shown below:
PortletRequest request = (PortletRequest)facesContext.getExternalContext().getRequest(); PortletResponse response = (PortletResponse)facesContext.getExternalContext().getResponse(); PortletContext context = (PortletContext)facesContext.getExternalContext().getContext();If you want to access the ActionEvent class in the IBM portlet API (org.apache.jetspeed.portlet.event.ActionEvent) for a Faces action, it can be obtained through a request attribute:
ActionEvent event = (ActionEvent)facesContext.getExternalContext().getRequestMap().get("com.ibm.faces.portlet.ACTION_EVENT");
Related concepts
Creating Faces portlets and projects
Related tasks
Adding and updating Faces portlet modes for existing IBM portlets
Adding and updating Faces portlet modes