Creating tabs in liferay

In Liferay creating tab is very easy task.

In our jsp , example as view.jsp

<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>

<%


String tabValue = ParamUtil.getString(request, "tab", "help");
String tabsURL = "/html/jsp/" + tabValue.trim() + ".jsp";
String names = "HELP,PREVIEW,PRINT";
String tabsValues = "help,preview,print";

%>



    <portlet:renderURL var="url" />
    <liferay-ui:tabs names="<%=names%>" tabsValues="<%=tabsValues%>" param="tab" url="${url}"  />
    <c:import url="<%=tabsURL%>" />

Here "/html/jsp/" is the folder of the jsps where it resides. You can give your own name.

Here we have given param name as tab. so we are reterving the parameter value in tab.

In your class no logic will reside as sample as below


        @Override
        public void render(RenderRequest request, RenderResponse response)
        throws PortletException, IOException {
     
        include(viewTemplate, request, response);
        }

Thats it!! Deploy your portlet and see the changes.

Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate