Jetspeed MyFaces Demo Portlet leverages Sun's Guess Number reference implementation sample application to illustrate how a MyFaces based portlet using Jetspeed 2 JSF bridge should be configured.
Jetspeed 2 provides a JSF bridge implementation to support JSF with the Portlet Specifications. This section describes the necessary configuration required in order to use Jetspeed 2 JSF bridge.
The modifications required in order to deploy a MyFaces application as a portlet need to be made to the portlet.xml file. An <init-param> should be added to the portlet.xml as described below:
<init-param> <name>ViewPage</name> <value>/greeting.jsp</value> </init-param>
The parameter ViewPage indicates to the org.apache.portals.bridges.jsf.FacesPortlet which view should be used as a default view.
Additionally, the <portlet-class> element should specify the MyFaces generic portlet implementation as described below:
<portlet-class>org.apache.portals.bridges.jsf.FacesPortlet</portlet-class>
This final portlet.xml should look like:
<portlet id="guessNumber"> <init-param> <name>ViewPage</name> <value>/greeting.jsp</value> </init-param> <description>JSF GuessNumber Portlet - Using J2 JSF Bridge</description> <portlet-name>guessNumber</portlet-name> <display-name>JSF GuessNumber Portlet - J2 JSF Bridge</display-name> <portlet-class>org.apache.portals.bridges.jsf.FacesPortlet</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>EDIT</portlet-mode> <portlet-mode>HELP</portlet-mode> </supports> <portlet-info> <title>GuessNumber Portlet</title> <short-title>guessNumber</short-title> </portlet-info> </portlet>