让 JSTL 在 Tomcat 和 Eclipse 中运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1521257/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting JSTL to run within Tomcat and Eclipse
提问by Alex004
I've been trying to get this to run, but I can't. I'm using Eclipse Galileo, Tomcat 5.5.23 and have several JSTLs around. My latest try was to use the GlassFish jar file "jstl-impl-1.2.jar". I placed it in Tomcat's shared lib, added it as external jar into my Eclipse project and exported it.
我一直试图让它运行,但我不能。我正在使用 Eclipse Galileo、Tomcat 5.5.23 并且有几个 JSTL。我最近的一次尝试是使用 GlassFish jar 文件“jstl-impl-1.2.jar”。我将它放在 Tomcat 的共享库中,将它作为外部 jar 添加到我的 Eclipse 项目中并导出它。
Could anybody tell me, which jars to load in which folder and how to tell it to load in Eclipse?
谁能告诉我,在哪个文件夹中加载哪些 jars 以及如何告诉它在 Eclipse 中加载?
回答by Juparave
It's very simple to include jstl in your projects, what I do is:
在您的项目中包含 jstl 非常简单,我所做的是:
Download jstl-1.2.jar (JSP 2.1 containers only i.e. Tomcat 6, otherwise jstl-1.1.jar) from http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/
or
the interfaces (javax.servlet.jsp.jstl-api-1.2.1.jar) from http://search.maven.org/#browse|707331597and the actual implementing classes (javax.servlet.jsp.jstl-1.2.2.jar) from http://search.maven.org/#browse%7C-1002239589.Copy to your project's WEB-INF/lib directory
- Include the following tags in yours jsp's:
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
从 http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/
或
接口(javax.servlet从.jsp.jstl-API-1.2.1.jar)http://search.maven.org/#browse|707331597和实际实现类(javax.servlet.jsp.jstl-1.2.2.jar从)HTTP ://search.maven.org/#browse%7C-1002239589。复制到你项目的 WEB-INF/lib 目录
- 在您的 jsp 中包含以下标签:
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
As for eclipse I need to know if your using any framework plugin, I use MyEclipse and it does it automatically for me.
至于 eclipse,我需要知道您是否使用任何框架插件,我使用 MyEclipse,它会自动为我完成。
回答by thedrs
Another method is shown here https://stackoverflow.com/tags/jstl/info
此处显示了另一种方法https://stackoverflow.com/tags/jstl/info
In short, download jstl.jar from here:
总之,从这里下载jstl.jar:
http://download.java.net/maven/1/jstl/jars/jstl-1.2.jar
http://download.java.net/maven/1/jstl/jars/jstl-1.2.jar
and drop it in your WEB-INF/lib dir
并将其放在您的 WEB-INF/lib 目录中
and add the line:
并添加以下行:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
in your jsp file.
在你的jsp文件中。
(don't forget to do F5 and clean and build after that)
(不要忘记执行 F5 并在此之后清理和构建)