Forums de discussion
Stuck in obtaining plid dynamically
Arunjyoti Banik, modifié il y a 8 années.
Stuck in obtaining plid dynamically
Junior Member Publications: 74 Date d'inscription: 26/08/14 Publications récentes
Hi all,
In my requirement, there is a portlet A in page 1 and portlet B in page 2. I just need to navigate from portlet A to portlet B. So in portlet A, I used
<liferay-portlet:renderURL var="navTopage" plid="32513" portletName="portletB_WAR_WCSGPortal" >
<liferay-portlet:param name="jspPage" value="/jsps/portletb.jsp"/>
</liferay-portlet:renderURL>
It is working perfectly. But the thing is it is working when I am just hardcoding the plid of portlet B in page 2. For dynamically I used:
<%
ThemeDisplay td =(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
Layout layout = td.getLayout();
long plid = layout.getPlid() ;
%>
<liferay-portlet:renderURL var="navTopage" plid="<%= plid %>" portletName="portletB_WAR_WCSGPortal" >
<liferay-portlet:param name="jspPage" value="/jsps/portletb.jsp"/>
</liferay-portlet:renderURL>
In the browser I can see the url is getting changed but the navigation is not happening. What change is needed for this??
Arun
In my requirement, there is a portlet A in page 1 and portlet B in page 2. I just need to navigate from portlet A to portlet B. So in portlet A, I used
<liferay-portlet:renderURL var="navTopage" plid="32513" portletName="portletB_WAR_WCSGPortal" >
<liferay-portlet:param name="jspPage" value="/jsps/portletb.jsp"/>
</liferay-portlet:renderURL>
It is working perfectly. But the thing is it is working when I am just hardcoding the plid of portlet B in page 2. For dynamically I used:
<%
ThemeDisplay td =(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
Layout layout = td.getLayout();
long plid = layout.getPlid() ;
%>
<liferay-portlet:renderURL var="navTopage" plid="<%= plid %>" portletName="portletB_WAR_WCSGPortal" >
<liferay-portlet:param name="jspPage" value="/jsps/portletb.jsp"/>
</liferay-portlet:renderURL>
In the browser I can see the url is getting changed but the navigation is not happening. What change is needed for this??
Arun
Amos Fong, modifié il y a 8 années.
RE: Stuck in obtaining plid dynamically (Réponse)
Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
Are you getting the right plid value? That would return the current page's plid. Try using one of these methods:
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/util/PortalUtil.html#getPlidFromFriendlyURL(long, java.lang.String)
or if your portlet is only on one other page.
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/util/PortalUtil.html#getPlidFromPortletId(long, java.lang.String)
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/util/PortalUtil.html#getPlidFromFriendlyURL(long, java.lang.String)
or if your portlet is only on one other page.
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/util/PortalUtil.html#getPlidFromPortletId(long, java.lang.String)
Arunjyoti Banik, modifié il y a 8 années.
RE: Stuck in obtaining plid dynamically
Junior Member Publications: 74 Date d'inscription: 26/08/14 Publications récentes
Thanks Amos. Worked like a charm and in one go. Right now all our portlets are in a same group. So for the groupId I am giving themedisplay.getScopeGroupId() now. But I think they will soon order us to access specific pages of another portlet placed in a private page of different group. .
Anyways many thanks for your answer.
Arun
Anyways many thanks for your answer.
Arun