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

查看:52
本文介绍了我应该把 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.

推荐答案

至于每一个你想在你的 webapp 中使用的3rd party library",只要把它们放在 /WEB-INF/lib Web 项目的文件夹.这样它会自动在类路径/构建路径中被采用.

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 中硬编码标签库.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 文件中,确保您使用的是 JSTL TLD 文档.例如,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.jarstandard.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天全站免登陆