[jboss-user] [JBoss Portal] - Re: JSF and Portal

stan.silvert@jboss.com do-not-reply at jboss.com
Mon Apr 2 10:33:38 EDT 2007


Using modes with JSF is a research topic at this point.  There is no agreement on the best way to do it.  Here is one approach: http://wiki.apache.org/myfaces/UsingPortletModes

You can get the request object by calling FacesContext.getExternalContext().getRequest().  You should check to make sure that you can cast to the PortletRequest if you think your code will be used outside a portlet.  If you are using the MyFaces portlet bridge, see http://wiki.apache.org/myfaces/UsingPortletUtil

Also, you can access managed beans using the EL.  

String value = (String)facesContext.getApplication()
  |                                  .createValueBinding("#{foo.prop}")
  |                                  .getValue(facesContext));
  | 

If you are outside the JSF lifecycle, you won't have access to the FacesContext.  In this case, you need to get the Application object from the ApplicationFactory.

ApplicationFactory appFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
  | Application app = appFactory.getApplication();


Stan
http://jsf.jboss.com

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033704#4033704

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033704



More information about the jboss-user mailing list