Forums de discussion
JSF navigation triggered from the GenericFacesPortlet
PortletFaces Community Member, modifié il y a 12 années.
JSF navigation triggered from the GenericFacesPortlet
Regular Member Publications: 199 Date d'inscription: 03/04/12 Publications récentes
Hi,
Is there a way to trigger the JSF navigation from the GenericFacesPortlet ? Or is there a way to change the current portlet displayed page like index.xhtml to somethingElse.xhtml from the GenericFacesPortlet ?
In an older IBM JSF 1.2 bridge i noticed that you could use:
request.getPortletSession().setAttribute("com.ibm.faces.portlet.page.view", "/MyPage.jsp");
in the doView method.
I wonder if there is a such option for the portletfaces bridge.
I have a JSF2 portlet running in a Liferay portal via an IBM WAS7 WSRP. The navigation for my portlet should be done trough a portal menu which is dynamically build based on some XML code passed inside my .xhtml pages where I can provide any kind of portlet specific URL like action/render etc. The problem is that once inside in the doView() , processAction() methods triggered by the links I provide I can't find a way to navigate to the xhtml page I want. I tried to use a PortletRequestDispatcher and include the request, response but it takes me out of the portlet context in to trying to run the portlet as a servlet.
Any ideas would be helpful.
Thanks.
Mihai
Is there a way to trigger the JSF navigation from the GenericFacesPortlet ? Or is there a way to change the current portlet displayed page like index.xhtml to somethingElse.xhtml from the GenericFacesPortlet ?
In an older IBM JSF 1.2 bridge i noticed that you could use:
request.getPortletSession().setAttribute("com.ibm.faces.portlet.page.view", "/MyPage.jsp");
in the doView method.
I wonder if there is a such option for the portletfaces bridge.
I have a JSF2 portlet running in a Liferay portal via an IBM WAS7 WSRP. The navigation for my portlet should be done trough a portal menu which is dynamically build based on some XML code passed inside my .xhtml pages where I can provide any kind of portlet specific URL like action/render etc. The problem is that once inside in the doView() , processAction() methods triggered by the links I provide I can't find a way to navigate to the xhtml page I want. I tried to use a PortletRequestDispatcher and include the request, response but it takes me out of the portlet context in to trying to run the portlet as a servlet.
Any ideas would be helpful.
Thanks.
Mihai
PortletFaces Community Member, modifié il y a 12 années.
RE: JSF navigation triggered from the GenericFacesPortlet
Regular Member Publications: 199 Date d'inscription: 03/04/12 Publications récentes
To answer my own question in the hope that maybe it will help someone in the future - it is enough to provide in your actionURL a parameter with the name _facesViewId and a value relative to your application context path
- java code approach :
FacesContext fctx = FacesContext.getCurrentInstance();
RenderResponse rresponse = (RenderResponse) fctx.getExternalContext().getResponse();
PortletURL actionURL = rresponse.createActionURL();
actionURL.setParameter("_facesViewId", "/xhtml/somePage.xhtml");
String url = actionURL.toString();
- or using the portlet tags :
<portlet:actionURL var="myLink">
<portlet:param name='_facesViewId' value='/xhtml/somePage.xhtml'/>
</portlet:actionURL>
<a href="#{myLink}">My Link</a>
- java code approach :
FacesContext fctx = FacesContext.getCurrentInstance();
RenderResponse rresponse = (RenderResponse) fctx.getExternalContext().getResponse();
PortletURL actionURL = rresponse.createActionURL();
actionURL.setParameter("_facesViewId", "/xhtml/somePage.xhtml");
String url = actionURL.toString();
- or using the portlet tags :
<portlet:actionURL var="myLink">
<portlet:param name='_facesViewId' value='/xhtml/somePage.xhtml'/>
</portlet:actionURL>
<a href="#{myLink}">My Link</a>
Neil Griffin, modifié il y a 11 années.