standard.jar是JSP 标准标签库,在1.0、1.1的版本中,和jstl.jar 一起使用,但在jstl-1.2.jar 就不再需要了。先上传两个jar,如何使用继续研究中。
JSTL versions
JSTL is available in different versions:
1.0: composed of two JAR files jstl.jar (the API) and standard.jar (the impl). Taglib URI has no /jsp in path like http://java.sun.com/jstl/core and the prototype version has the library name suffixed with _rt like http://java.sun.com/jstl/core_rt. Came along with and requires at minimum Servlet 2.3 / JSP 1.2. It is at end of life, do not use it any more.
1.1: composed of same JAR files as 1.0. Taglib URI includes /jsp in the path like http://java.sun.com/jsp/jstl/core. Came along with and requires at minimum Servlet 2.4 / JSP 2.0. Downloadable here.
1.2: composed of one JAR file jstl-1.2.jar (bundled API+impl) and has same taglib URI as 1.1. Came along with Servlet 2.5 / JSP 2.1 but works at Servlet 2.4 / JSP 2.0 as well. Downloadable here.
1.2.1: composed of two JAR files javax.servlet.jsp.jstl-api-1.2.1 (the API) and javax.servlet.jsp.jstl-1.2.1.jar (the impl) and has same taglib URI as 1.1. Came along with Servlet 3.0 / JSP 2.2 but works at Servlet 2.5 / JSP 2.1 and Servlet 2.4 / JSP 2.0 as well. Downloadable here and here.
Facelets: Facelets, the successor of JSP, has among the provided taglibs a selected subset of JSTL 1.2 core and the full set of JSTL 1.2 functions builtin. This requires a minimum of JSTL 1.2. For Facelets 1.x the XML namespace URI is http://java.sun.com/jstl/core and for Facelets 2.x the XML namespace URI is http://java.sun.com/jsp/jstl/core with (confusingly!) the /jsp part.
Installing JSTL
It's actually quite simple:
Only when your servletcontainer doesn't ship with JSTL (e.g. Tomcat), place the JAR file(s) in Webapp/WEB-INF/lib (which is covered by the default webapp's classpath, so in a bit smart IDE you don't need to do anything else).
Declare the taglib in JSP file with the right TLD URI. You can find here the TLD documentation that applies to both JSTL 1.1 and JSTL 1.2. Click the taglib of interest to get the declaration examples. For example the JSTL core taglib
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
If you're using Facelets instead of JSP, it should be declared as XML namespace instead
<html xmlns:c="http://java.sun.com/jsp/jstl/core">
You only need to ensure that you have no duplicates of older JSTL versions in the classpath (includes JRE/lib and Appserver/lib) to avoid collisions. If you have full admin-level control over the appserver, then you could also place the JAR file(s) in Appserver/lib instead of Webapp/WEB-INF/lib so that they get applied to all deployed webapps. At least do NOT extract the JAR file(s) and clutter the classpath with their contents (the loose TLD files) and/or declare the taglibs in your webapp's web.xml as some poor online tutorials suggest.
Help! The expression language (EL, those ${} things) doesn't work in my JSTL tags!
The declared servlet version in web.xml is very important to get JSTL and EL to work properly. You need to ensure that you're using a servletcontainer that supports the minimum required Servlet version for the JSTL version. Apache Tomcat 6.0 for example is a Servlet 2.5 container. You should then declare your web.xml conform to the Servlet 2.5 specification, this works for both JSTL 1.1 and 1.2:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- Config here. -->
</web-app>
分享到:
相关推荐
解决方法:移出工程lib目录中的JSTL1.2.jar,添加standard-1.1.jar和JSTL1.1.jar 总结: jstl1.1版本由2个必要包构成:standard-1.1.jar和JSTL1.1.jar;而jstl1.1版本只有一个必要包JSTL1.2.jar。(一开始在替换的...
**JSTL.jar和standard.jar包详解** 在Java Web开发中,JSTL(JavaServer Pages Standard Tag Library)和standard.jar是两个非常重要的组件,它们主要用于简化JSP页面的编程,提高代码的可读性和可维护性。这两个库...
而`jstl.jar`和`standard.jar`是JSP开发中两个重要的库文件,主要用于提供JSTL(JavaServer Pages Standard Tag Library)标准标签库的支持。 JSTL是由Apache软件基金会的Tomcat项目开发的,它为JSP提供了一套标准...
在使用JSTL时,有两个核心的JAR文件是必不可少的:`jstl.jar`和`standard.jar`。这两个文件包含了JSTL的核心实现和相关的支持库。 1. `jstl.jar`:这是JSTL的主要库文件,包含了JSTL的所有核心标签类和接口。这些...
如果`jstl.jar`和`standard.jar`没有被放到`WEB-INF/lib`下,那么JSP页面中引用的JSTL标签可能无法正常工作,导致编译错误或运行时异常。因此,确保这两个库文件的位置正确是至关重要的,否则可能会影响到Web应用的...
在Web开发领域,JSP(JavaServer Pages)技术是用于创建动态网页的工具,而JSTL(JavaServer Pages Standard Tag Library)和standard.jar则是JSP开发中的两个重要组件,它们大大简化了JSP页面的编写,提高了代码的...
标题中的"共两个jar包:jstl.jar和standard.jar"指的是两个重要的Java Web开发库。JSTL(JavaServer Pages Standard Tag Library)是JavaServer Pages标准标签库,它提供了一系列预定义的标签来简化JSP页面的编写,...
标题 "jstl.jar和standard.jar" 涉及的是两个关键的Java库,它们在Web开发中扮演着重要角色,特别是在使用JavaServer Pages (JSP) 和JavaServer Pages Standard Tag Library (JSTL) 技术时。这两个库经常在MyEclipse...
在Java开发中,`standard.jar` 和 `jstl.jar` 是两个非常重要的库文件,它们主要用于处理JSP(JavaServer Pages)中的标签库。这两个jar包是Java Web开发的关键组成部分,尤其是对于那些使用JSTL(JavaServer Pages ...
将`jstl.jar`和`standard.jar`两个文件复制到`WEB-INF/lib`目录下是使用JSTL的常规步骤。这是因为它们是Web应用的依赖库,需要被Web容器(如Tomcat、Jetty等)加载。在JSP页面中,通过以下方式引入JSTL库: ```jsp ...
在Java Web开发中,`jstl.jar` 和 `standard.jar` 是两个非常重要的库文件,它们主要用于处理视图层的呈现,尤其是在使用JSP(JavaServer Pages)时。这两个jar文件包含了JSTL(JavaServer Pages Standard Tag ...
**The absolute uri:http://java.sun.com/jsp/jstl/core(也可能是...可能二:项目目录下WEB-INF/lib下没有jstl.jar*,standard.jar 可能三:tomca的lib目录下没有jstl.jar,standard.jar 所需要下载的东西
结合使用**jstl.jar**和**standard.jar**,开发者可以构建出高效、可维护的JSP应用。例如,通过JSTL的`<c:set>`标签设置变量,然后在页面上使用EL表达式来输出或处理这些变量。此外,`<jsp:useBean>`和`...
1. **下载JAR文件**:首先需要从官方或可靠的源下载`jstl.jar`和`standard.jar`。 2. **添加到类路径**:将这两个JAR文件添加到Web应用程序的WEB-INF/lib目录下,这样Tomcat或其他Servlet容器在运行时就能找到它们。...
包含了两个版本jstl文件,standard.jar和jstl-api-1.2.jar是一个版本,导入时需要将两个都导入,jstl-1.2.jar是高版本的,是将低版本的两个文件合成一个了,故只需要导入一个文件即可,导入的同时在jsp文件首行写入 ...
当你在项目中使用JSTL时,通常需要同时引入jstl.jar和standard.jar,因为jstl.jar中只包含JSTL的接口和API定义,而实际的实现逻辑在standard.jar中。 **JSTL与EL(Expression Language)的结合** JSTL可以与Java...