问题
When I developed my portlet and when i wrote my jsp page I used:
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%>
but eclipse show me an error telling me that it cannot find the tag lib descriptor for http://java.sun.com/portlet_2_0.
How can I resolve this issue wihtout using tld files ?
回答1:
In my case, I am using Liferay Portal, so in order to avoid this error
I changed:
<%@ taglib uri="http://java.sun.com/portlet_2_0"% prefix="portlet">
to
<%@ taglib uri="/WEB-INF/tld/liferay-portlet.tld" prefix="portlet" %>
and in file "WEB-INF/liferay-plugin-package.properties"; I added this line
portal-dependency-tlds=/WEB-INF/tld/liferay-portlet.tld
which is suggested by a Liferay staff (Link)
回答2:
Remove the line
<%@ taglib uri="http://java.sun.com/portlet_2_0"% prefix="portlet">
and paste this line:
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
Then, in WEB-INF/tld
folder put these files: aui.tld
, liferay-portlet.tld
, liferay-portlet-ext.tld
, liferay-security.tld
, liferay-theme.tld
, liferay-ui.tld
, liferay-util.tld
.
回答3:
You can download portlet-2.0.jar and add it to your project path. But if you are developping for Liferay I would recommand you to use the liferay-portlet.tld
which has the portlet 2.0 specification.
回答4:
If you add this to the web.xml in the WEB-INF folder it will remove the Eclipse error message.
<web-app>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
</web-app>
Hope it helps.
回答5:
This error just means that Eclipse is unable to find a tag library descriptor (TLD) that resolves the given (http://java.sun.com/portlet_2_0) tag URI. You can download the TLD corresponding to your portal container (Gatein, Pluto, Liferay, etc) from GitHub and place it in WEB-INF folder. Gatein specific tld can be found here. Also, make sure that you have the portlet_2.0 jar in your project path.
来源:https://stackoverflow.com/questions/13991799/error-in-my-taglib-taglib-prefix-portlet-uri-http-java-sun-com-portlet