Foros de discusión

Aui tabs

Suresh Krishna, modificado hace 10 años.

Aui tabs

New Member Mensajes: 19 Fecha de incorporación: 3/09/13 Mensajes recientes
Hi ,

i have to implement 3 tabs in one jsp for example Tab#1 Tab#2 Tab#3, This one i implemented using <liferay-ui:tabs names="<%= tabNames %>" url="<%= portletURL.toString() %>"/> , But now i want to add another 3 tabs inside Tab#1 ,Please suggest me how to implement

Thanks,
Suresh
thumbnail
Pankaj Kathiriya, modificado hace 10 años.

RE: Aui tabs

Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
<portlet:renderurl var="portletURL"></portlet:renderurl>  
   <liferay-ui:tabs param="currTAB" names="tab1,tab2,tab3" refresh="<%= true %>" url="<%=portletURL.toString() %>">  
       <liferay-ui:section>  
        &lt;%@ include file="tab1.jsp" %&gt;  
       </liferay-ui:section>  
       <liferay-ui:section>  
        &lt;%@ include file="tab2.jsp" %&gt;  
       </liferay-ui:section>  
       <liferay-ui:section>  
        &lt;%@ include file="tab3.jsp" %&gt;  
       </liferay-ui:section>  
   </liferay-ui:tabs>  


Here is example of liferay-ui:tab tag. Each liferay-ui:section refers to content to tabs sequentially.

To have tabs under Tab1, you just have same liferay-ui:tab used in tab1.jsp.

Regards,
Pankaj
Suresh Krishna, modificado hace 10 años.

RE: Aui tabs

New Member Mensajes: 19 Fecha de incorporación: 3/09/13 Mensajes recientes
Hi Pankaj,

Thanks for your reply, I am using spring MVC portlet my all Tab1,Tab2,Tab3 portletURL referring to Master.jsp my subTabs are there in View1.jsp,I added all the subtabs into view1.jsp but its rendering subtabs

Thanks,
Suresh
thumbnail
Pankaj Kathiriya, modificado hace 10 años.

RE: Aui tabs

Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
I didnt get your issue, can you paste code snippet here?
Suresh Krishna, modificado hace 10 años.

RE: Aui tabs

New Member Mensajes: 19 Fecha de incorporación: 3/09/13 Mensajes recientes
Hi Pankaj,

I have added 3 tabs in master.jsp i.e view1.jsp,view2.jsp and view3.jsp in view1.jsp i added again 3 tabs those are renderring master.jsp main tab instead of sub tab. i have attached both Master.jsp and view1.jsp as well

1. Master.jps

<portlet:defineObjects/>
<%
PortletURL portletURL = renderResponse.createRenderURL();
String currTAB = ParamUtil.getString(request, "currTAB", "receiptTabs");
portletURL.setParameter("render", currTAB );
%>
<portlet:defineObjects />
<portlet:actionURL var="saveAcc" name="saveAcc">
</portlet:actionURL>
<aui:form name="receipt" id="receipt" action="<%=saveAcc%>"
method="Post">
<aui:column first="true" columnWidth="30">
<jsp:include page="preview.jsp" />
</aui:column>
<aui:column columnWidth="70">
<liferay-ui:tabs names="Tab1,Tab2,Tab3" refresh="<%= false %>" url="<%= portletURL.toString() %>">

<liferay-ui:section >
<%@ include file="view1.jsp" %>
</liferay-ui:section>

<liferay-ui:section>
<%@ include file="view2.jsp" %>
</liferay-ui:section>

<liferay-ui:section>
<%@ include file="view3.jsp" %>
</liferay-ui:section>

</liferay-ui:tabs>
</aui:column>

2. View1.jsp

<%
PortletURL portletURL1 = renderResponse.createRenderURL();
String currSubTAB = ParamUtil.getString(request, "currSubTAB", "SubTabs");
portletURL1.setParameter("render", "");
%>
<div>
<aui:input name="did" type="text" cssClass="txtbox-default-supplierno">
<aui:validator name="required" />
</aui:input>
<liferay-ui:tabs names="SubTab1,SubTab2,SubTab3" refresh="<%= false %>" url="<%= portletURL.toString() %>">

<liferay-ui:section >
Sub tab1
</liferay-ui:section>

<liferay-ui:section>
Sub Tab2
</liferay-ui:section>

<liferay-ui:section>
Sub Tab3
</liferay-ui:section>
</liferay-ui:tabs>

I am getting below Error


2014-01-20 06:24:10,179 ERROR [render_portlet_jsp:154] java.lang.NullPointerException
at com.liferay.util.JS.toScript(JS.java:121)
at org.apache.jsp.html.taglib.ui.tabs.end_jsp._jspService(end_jsp.java:426)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:97)
thumbnail
Diego Morales, modificado hace 10 años.

RE: Aui tabs

Junior Member Mensajes: 50 Fecha de incorporación: 26/11/13 Mensajes recientes
Can you try doing <liferay-util:include> instead
thumbnail
sushil patidar, modificado hace 10 años.

RE: Aui tabs

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi Suresh,

You can implement the required functionality as follows.

&lt;%
String tabs= ParamUtil.getString(request, "tabs", "");
%&gt;
<liferay-ui:tabs names="tab1,tab2,tab3" refresh="<%= true %>" url="<%=portletURL.toString() %>" param="tabs" />  
  <c:if test="<%=tabs.equals(" tab1")%>"&gt;
          &lt;%@ include file="tab1.jsp" %&gt; 
  </c:if>
    <c:if test="<%=tabs.equals(" tab2")%>"&gt;
          &lt;%@ include file="tab2.jsp" %&gt; 
  </c:if>
  <c:if test="<%=tabs.equals(" tab3")%>"&gt;
          &lt;%@ include file="tab3.jsp" %&gt; 
  </c:if>
thumbnail
Bartosz Przybyłek, modificado hace 7 años.

RE: Aui tabs

New Member Mensajes: 3 Fecha de incorporación: 21/08/12 Mensajes recientes
Actually your problem with null pointer is due to clearing request attributes by subTabs. Taglib "liferay-ui:tabs" use:


// Names
String[] names = (String[])request.getAttribute("liferay-ui:tabs:names");
String namesJS = JS.toScript(names); //Exact line that throws NullPointerException in end.jsp


Which are cleared after end of tag. What you would have to do is to populate attributes for parent taglib.

Simplified example:


<liferay-ui:tabs names="<%= tabNames %>" param="tabs2" refresh="<%= false %>">
        <liferay-ui:section>
        // Your include with another tabs
            <liferay-ui:tabs names="<%= tabNames2 %>" param="tabs3" refresh="<%= false %>">
				 <liferay-ui:section>
                                 //Some code you want to display in this tab
				 </liferay-ui:section>
            </liferay-ui:tabs>
			//After that code attribute liferay-ui:tabs:names is null that's why you have to reinitialize it
			&lt;%
			request.setAttribute("liferay-ui:tabs:param", parentParam);
			request.setAttribute("liferay-ui:tabs:names", parentTabArray);
			%&gt;
    </liferay-ui:section>
</liferay-ui:tabs>