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?
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?
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
tab.jsp
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
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ page import="javax.portlet.PortletURL" %>
<%@ page import="javax.portlet.ActionRequest" %>
<%@ page import="javax.portlet.PortletRequest" %>
<liferay-portlet:renderurl var="portletURL" />
<%
String tabValue = ParamUtil.getString(request, "tab", "sampleTab1");
String includeURL = tabValue.trim() + ".jsp";
%>
<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
to
Then the problem is gone.
<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.