日期:2014-05-16  浏览次数:20429 次

jstl标签使用
同事用MyEclipse创建的工程,MyEclipse很“智能的”帮忙添加了,jstl的支持。
在打包war包的里候,发现在服务器上突然不支持jstl了,打包后,MyEclipse没有将jstl相关的包添加进去。就是上面所述的造成的。

一气之下,决定不使用MyEclipse的“智能”,“机器再智能还不如人类”。
在http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/下载最新的版本。解压,将解压的lib目录下的jar包添加到你工程的lib目录下。

需要说明的是:我的工程用的是2.4的版本。
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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_4.xsd">


</web-app>


标签描述语句如下:
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

所有的标签描述在README里面有,你可以直接copy.下面是README FILE 的内容了:
引用

---------------------------------------
Standard Tag Library 1.1 -- BINARY DISTRIBUTION
---------------------------------------
Thanks for downloading this release of the Standard tag library,
an implementation of the JavaServer Pages(tm)(JSP)
Standard Tag Library (JSTL).

JSTL is an effort of the Java Community Process (JCP) and
comes out of the JSR-052 expert group. For more information on JSTL,
please go to http://java.sun.com/products/jstl.

We hope you find the tags, documents, and examples in this binary
distribution of interest.

---------------------------------------
LIBRARY DEPENDENCIES

This version of the Standard Tag Library has the following runtime
dependencies:

   1. Dependencies provided by the JSP 2.0 container:
      - Servlet 2.4
      - JSP 2.0

   2. Dependencies provided in newer J2SEs (1.4.2 and higher)
      - JAXP 1.2
      - Xalan 2.5
      - JDBC Standard Extension 2.0

Since all of the dependencies in (2) are included in Sun's
distribution of J2SE 1.4.2 (and higher), this is therefore the J2SE
version of choice to use the standard tag library.

If the java platform under which you run your JSP container does not
provide these dependencies, they must be made available either globally
to all web-applications by your container, or individually within the
WEB-INF/lib directory of your web-application.

For convenience, these jar files have been included in directory
lib/old-dependencies of this distribution (assuming the build process
of this distribution included them). If you would like to download
these jar files yourself, instructions on where you can get them are
included below.

---
JAXP 1.2

The JAXP 1.2 jar files can be obtained in the Java Web Services
Developer Pack (JWSDP) available at
http://java.sun.com/products/jwsdp.

  - jaxp-api.jar
  - dom.jar
  - sax.jar
  - xercesImpl.jar

---
Xalan 2.5

The Xalan jar file can be obtained in the Java Web Services
Developer Pack (JWSDP) available at
http://java.sun.com/products/jwsdp, as well as from
Apache at http://xml.apache.org/xalan-j.

  - xalan.jar

Please note that if you use Sun's distribution of J2SE 1.4.1, you must
supersede the version of xalan.jar provided by the J2SE with version
2.5 or higher of Xalan.  This newer version of xalan.jar must then be
made available through the endorsed dirs mechanism.

---
JDBC Standard Extension 2.0

The JDBC 2.0 Optional Package can be obtained from:
http://java.sun.com/products/jdbc/download.html

  - jdbc2_0-stdext.jar