Stan-
thanks for pointing that out.
Btw the quickstart is located here: http://cvs.apache.org/viewcvs.cgi/incubator-myfaces/doc/portlet_quick_start.txt?rev=1.1&view=markup
-Matthias
Stan Silvert wrote:
One approach is to provide JSF bridge. Basically, to create a JSFPortlet and use it as a bridge to the FacesServlet. Sun, exoplatform and many others already provide this kind of solution.
The bridge solution sounds like a hack to me. I suspect that there are a few instances where that solution won't actually work as expected.
The spec-based solution I did does not go through the FacesServlet at all. You just use an instance of MyFacesGenericPortlet which handles portlet requests and calls directly into the MyFaces implementation. MyFacesGenericPortlet is a drop-in replacement for the FacesServlet.
Actually, I was unaware of and very surprised to hear that Sun uses a bridge. Can someone else confirm this? I purposely stayed away from looking at the RI because I didn't want to be influenced by it. You are saying that the RI doesn't implement its own spec? That is very strange.
Another approach is to complete the JSF implementation. JSF spec already contains the support for porlet, however, most JSF implementation is not complete and does not support porlet. I think it is a much better approach.
Glad to see the Stan Silvert provided the portlet support patch for MyFaces. Actually, his changes are included inside 1.0.9.
Did anyone created a sample JSF based portlet using the new code? Stan
claimed that he has tested his changes on Pluto. Any idea about how it
works?
I did test this on Pluto. I got the CarDemo and another JSF app to run side by side in the same portal page. It works great. The only change you have to make to the JSF application is to get rid of any redirects.
For my understanding, I still need to create some kind of bridge JSF portlet and somehow to forward the request to FacesServlet.
If you are running your JSF application as a portlet then you do not need to create anything. I have attached the "Portlet Quick Start" instructions. These instructions have been committed to MyFaces, but I don't know off hand where they were put.
Please advice. Thanks. Derek
------------------------------------------------------------------------
/* * 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>
-- Matthias We�endorf Aechterhoek 18 DE-48282 Emsdetten Germany phone: +49-2572-9170275 cell phone: +49-179-1118979 email: matzew AT apache DOT org url: http://www.wessendorf.net callto://mwessendorf (Skype) icq: 47016183
