我在哪里放置jstl.jar和standard.jar,以便Netbeans不会给出错误/警告? [英] Where do I put jstl.jar and standard.jar so that Netbeans don't give errors/warnings?

查看:194
本文介绍了我在哪里放置jstl.jar和standard.jar,以便Netbeans不会给出错误/警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将jstl.jarstandard.jar放在哪里,以便Netbeans不再给出有关taglib的错误/警告.

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

推荐答案

对于要在Web应用程序中使用的每个第三方库",只需将它们放在Web项目的/WEB-INF/lib文件夹中即可.这样,它将自动在classpath/buildpath中获取.

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.

您只需要确保您提取JAR文件并将其松散内容也放置在类路径中和/或将标签库硬编码在Webapp自己的web.xml中.诸如 roseindia (咳嗽)之类的一些较差的在线教程即提出了这种建议.不要那样做这只会使事情变得更糟.

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.

然后,在您的JSP文件中,确保您使用的是正确的taglib URI,如 JSTL核心需要声明如下:

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" %>

请注意/jsp路径.它是从JSTL 1.1开始引入的. JSTL 1.0没有/jsp路径.如果您在JSTL 1.1/1.2中省略了它,那么事情将无法进行.另请注意,您不应使用_rt后缀,例如/core_rt,这是旧的原型版本.

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.

顺便说一句,在 jstl-1.2.jar standard.jar已过时.如果需要,只需删除当前拥有的jstl和标准JAR,然后使用此单个JAR(是的,只需放入/WEB-INF/lib,一切都会顺利进行).

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

这篇关于我在哪里放置jstl.jar和standard.jar,以便Netbeans不会给出错误/警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆