Where do I put jstl.jar and standard.jar so that Netbeans don't give errors/warnings?
Where do I put jstl.jar
and standard.jar
so that Netbeans don't give errors/warnings anymore about 开发者_运维知识库the taglib.
As for every "3rd party library" which you'd like to use in your webapp, just put them in /WEB-INF/lib
folder of your web project. This way it will automatically be taken in the classpath/buildpath.
You only need to ensure that you have not extracted the JAR file(s) and placed its loose contents in the classpath as well and/or hardcoded the taglibs in webapp's own web.xml
. Some poor online tutorials such as roseindia (cough) namely suggests it that way. Don't do that. It will make things only worse.
Then, in your JSP files ensure that you're using the right taglib URI's as outlined in the JSTL TLD documentation. For example, JSTL core needs to be declared as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Note the /jsp
path. It was introduced since JSTL 1.1. The JSTL 1.0 doesn't have the /jsp
path. If you omit it in JSTL 1.1/1.2, then things won't work. Also note that you should't use the _rt
suffix such as /core_rt
, this was the old prototype version.
By the way, in jstl-1.2.jar the standard.jar is obsolete. If you want, just delete both the jstl and standard JAR's you currently have and use this single JAR instead (yes, just drop in /WEB-INF/lib
and anything will go flawlessly).
精彩评论