Where do I put jstl.jar and standard.jar so that Netbeans don't give errors/warnings?

浪子不回头ぞ 提交于 2019-11-27 08:08:37

问题


Where do I put jstl.jar and standard.jar so that Netbeans don't give errors/warnings anymore about the taglib.


回答1:


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).



来源:https://stackoverflow.com/questions/2323645/where-do-i-put-jstl-jar-and-standard-jar-so-that-netbeans-dont-give-errors-warn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!