<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
  <properties>
    <title>Jetspeed MyFaces Demo Portlet Configuration</title>
    <subtitle>MyFaces Demo Portlet Configuration - Built-In Portlet Support</subtitle>
    <authors>
      <person name="David Le Strat" email="dlestrat@apache.org"/>
    </authors>
  </properties>
  <body>
  
<section name="Introduction">
<p>
Jetspeed MyFaces Demo Portlet leverages Sun's Guess Number reference example implementation sample application to
illustrate how a MyFaces based portlet using Jetspeed 2 JSF bridge should be configured.
</p>
<p>
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.
</p>
</section>
<section name="Configuration MyFaces as a Portlet">
<p>
The modifications required in order to deploy a MyFaces application as a portlet need to be made to the
<i>portlet.xml</i> file. An <i>&lt;init-param&gt;</i> should be added to the <i>portlet.xml</i> as described below:
<source><![CDATA[
<init-param>
    <name>ViewPage</name>
    <value>/greeting.jsp</value>
</init-param>]]>
</source>
</p>
<p>
The parameter <i>ViewPage</i> indicates to the <i>org.apache.portals.bridges.jsf.FacesPortlet</i> which view
should be used as a default view.
</p>
<p>
Additionally, the &lt;portlet-class&gt; element should specify the MyFaces generic portlet implementation as described
below:
<source>
<![CDATA[<portlet-class>org.apache.portals.bridges.jsf.FacesPortlet</portlet-class>]]>
</source>
</p>
<p>
This final <i>portlet.xml</i> should look like:
<source><![CDATA[
<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>]]>
</source>
</p>
</section>

  </body>
</document>