Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
JSF navigation triggered from the GenericFacesPortlet
PortletFaces Community Member, modified 14 Years ago.
Regular Member
Posts: 199
Join Date: 4/3/12
Recent Posts
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, modified 14 Years ago.
Regular Member
Posts: 199
Join Date: 4/3/12
Recent Posts
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>
Community
Company
Feedback