Fórum

Liferay tabs not working

Suyesh Amatya, modificado 9 Anos atrás.

Liferay tabs not working

Junior Member Postagens: 61 Data de Entrada: 22/08/14 Postagens Recentes
I am following the tabs example provided in the net. Some links to the sources are
tab example 2
tab example 1
They work fine when the tabs are created/rendered in the default view.jsp and I can navigate to different tabs. But say, I put the code for this in tabs.jsp and instead provide the link in view.jsp to go to tabs.jsp. The tabs are displayed fine. But now when I click on any of the tabs, then I am redirected back to the view.jsp instead of supposedly opening the corresponding tabs pages.

What I am missing here?
thumbnail
Andew Jardine, modificado 9 Anos atrás.

RE: Liferay tabs not working

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Can you share your code with us so we can see your version of the example?
Suyesh Amatya, modificado 9 Anos atrás.

RE: Liferay tabs not working

Junior Member Postagens: 61 Data de Entrada: 22/08/14 Postagens Recentes
Please find the code here.

view.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<portlet:defineobjects />

<portlet:renderurl var="tabURL">
    <portlet:param name="mvcPath" value="/tab.jsp" />
</portlet:renderurl>

<p><a href="<%= tabURL %>">Tabs</a></p>


tab.jsp
&lt;%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %&gt;
 &lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %&gt;
 
  
&lt;%@ page import="com.liferay.portal.kernel.util.ParamUtil" %&gt;
&lt;%@ page import="javax.portlet.PortletURL" %&gt;
&lt;%@ page import="javax.portlet.ActionRequest" %&gt;
&lt;%@ page import="javax.portlet.PortletRequest" %&gt;
 
<liferay-portlet:renderurl var="portletURL" />
&lt;%
String tabValue = ParamUtil.getString(request, "tab", "sampleTab1");
String includeURL = tabValue.trim() + ".jsp";
%&gt;
 
<liferay-ui:tabs names="Sample Tab 1,Sample Tab 2,Sample Tab 3" tabsValues="sampleTab1,sampleTab2,sampleTab3" param="tab" url="<%= portletURL %>" />
 
<c:import url="<%= includeURL %>" />
Suyesh Amatya, modificado 9 Anos atrás.

RE: Liferay tabs not working (Resposta)

Junior Member Postagens: 61 Data de Entrada: 22/08/14 Postagens Recentes
Turns out the renderURL in tab.jsp should also contain the portlet param. So in tab.jsp if I change
<liferay-portlet:renderurl var="portletURL" />


to

<liferay-portlet:renderurl var="portletURL">
<portlet:param name="mvcPath" value="/tab.jsp" />
</liferay-portlet:renderurl>


Then the problem is gone.