Yes, you do need to remove all redirects.  Portlets don't like them. :-)

I attached the old portlet_quick_start document.  There are instructions
for converting a JSF app to a JSF portlet.  I'm not sure why it is no
longer included on the MyFaces site.

Stan Silvert
JBoss, Inc.
[EMAIL PROTECTED]
callto://stansilvert

> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 18, 2006 1:58 PM
> To: [email protected]
> Cc: [EMAIL PROTECTED]
> Subject: Apache Con US 2005 - Myfaces Portlet support
> 
> Hi Matthias,
> 
> I have the presentation that you have given at the ApacheCon, San
diego.
> One of my colleague has attended it.
> 
> You have mentioned about the built in support for JSR 168 in myfaces
and
> described a set of steps to convert a myfaces web app into a portlet.
> 
> I was trying it out but havent succeeded yet.
> 
> You have asked to remove the redirects from faces-config.xml if any.
> Does it include navigation rules also? I dont think so.
> 
> My portlet.xml looks like this :
> 
> <portlet-app id="helloWorld" version="1.0">
>   <portlet id="helloWorld">
>     <init-param>
>       <name>default-view</name>
>       <value>/helloWorld.jsp</value>
>     </init-param>
>     <description>helloWorld</description>
>     <portlet-name>helloWorld</portlet-name>
>     <display-name>helloWorld</display-name>
>     <portlet-
> class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
>     <portlet-info>
>       <title>helloWorld Portlet</title>
>       <short-title>helloWorld</short-title>
>     </portlet-info>
>   </portlet>
> </portlet-app>
> 
> MyFacesGenericPortlet is in myfaces-impl.jar and its included in
> WEB-INF/lib folder.
> 
> I tried installing it on jetspeed2 portal server. The portlet was
> installed successfully but when I try to add it to a page, I got the
> following error message :
> 
> ERROR org.apache.jetspeed.factory.JetspeedPortletFactory - Cannot
create
> Portlet instance org.apache.myfaces.portlet.MyFacesGenericPortlet
> 
> It would be great if you could provide a sample application for this.
> 
> I was successful in converting a myfaces web app into a portlet using
JSF
> bridge though.
> 
> It would be of great help if you could explain the steps in detail for
in
> built support for portlet.
> 
> Thanks,
> Sunil

/*
 * Copyright 2005 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.
 */

How to create a JSF Portlet using MyFaces:

1. Make sure your JSF MyFaces application runs as a stand-alone servlet.
2. Remove any redirects from your faces-config.xml.  Portlets can not handle 
these.
3. Create a Portlet WAR as per the instructions for your Portlet container.  
Make sure it contains everything that was included in step 1.
4. Update your portlet.xml file as follows:

<!-- You must use this Portlet impl class -->
<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>

<!-- The "home page" of your JSF application -->
<!-- This is a required param.               -->
<init-param>
   <name>default-view</name>
   <value>/some_view_id_from_faces-config</value>
</init-param>

<!-- A class name that implements 
org.apache.myfaces.portlet.DefaultViewSelector -->
<!-- This optional param is used if your want to choose different default views 
 -->
<!-- based on some condition.  You still must specify default-view above, but   
 -->
<!-- this impl will take precedence.                                            
 -->
<init-param>
   <name>default-view-selector</name>
   <value>com.foo.MyViewSelector</value>
</init-param>

Reply via email to