ASR
ASR

Reputation: 3559

how to solve core_rt tag lib issues in liferay tab?

i have got the following error while working with tabs concept in view.jsp: The absolute uri: http://java.sun.com/jstl/core_rt cannot be resolved in either web.xml or the jar files deployed with this application while using jstl. i have added the jar file jstl-1.2.jar file. the following is my view.jsp: can any one help me for correct code?

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@page import="com.liferay.portal.security.permission.*" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@page import="com.liferay.portal.theme.*" %>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>


//A renderURL is created because we need to render a jsp page you need to use //renderURL we can also  pass parameters if required

<%
//We must Specify a default value for tabs. In this example it is sunday. Else it //will throw an error.
String tabValue = ParamUtil.getString(request, "tab", "sunday");
String tabsURL = "/html/tab" + tabValue.trim() + ".jsp";
String tabNames="Sunday,Monday,Tuesday" ;
String tabVal="sunday,monday,tuesday" ;
%>

<liferay-ui:tabs
names="<%=tabNames%>"
tabsValues="<%=tabVal%>"
param="tab"
url="<%= portletURL %>"
/>

Upvotes: 2

Views: 2379

Answers (1)

Laxman Rana
Laxman Rana

Reputation: 2924

Add the following in web.xml

<jsp-config>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>
            <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
        </taglib>
</jsp-config>

Edit

It is always better to include libraries from Liferay portal itself instead of including external jars directly in WEB-INF/lib of the portal. You can include the JSTL jars from liferay by specifying following in your liferay-plugin-package.properties instead of including the jstl1.2.jar:

portal-dependency-jars=\
    jstl-api.jar,\
    jstl-impl.jar

Note: The edit is done based on the comments

Upvotes: 4

Related Questions