日期:2014-05-16 浏览次数:20506 次
现在不怎么做前台开发,对jstl已经很陌生了,偶尔要用的时候很多基本的东西一下想不起来,故转载本文用作备用资料。
原文出处:http://blog.csdn.net/rocket5725/archive/2009/03/31/4038403.aspx
======================================================================
?
一、在Tomcat中安装JSTL
前提 OS: WIN2003;Tomcat5.5;tomcat已经配置好。
1.准备jstl
?? 到http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/下载jakarta-taglibs-standard-1.1.2.zip
解压后成为jakarta-taglibs-standard-1.1.2
2.准备web开发目录
?? 比如我的web目录系统默认目录%tomcat_home%\webapps\ROOT下,工作目录为ROOT,也可以自定义工作目录,但必须要保证工作目录下建立WEB-INF\lib,WEB-INF\classes
3.拷贝.jar文件
?? 将jakarta-taglibs-standard-1.1.2\lib\下的两个jar文件:standard.jar和jstl.jar文件拷贝到工作目录的\WEB-INF\lib\下
4.拷贝.tld文件
?将jakarta-taglibs-standard-1.1.2\tld\下的15个tld类型文件拷到"Working folder\WEB-INF\tld"下
5.在工作目录下的\WEB-INF\下建立web.xml文件:
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <taglib> <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri> <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/fmt-1_0</taglib-uri> <taglib-location>/WEB-INF/tld/fmt-1_0.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/fmt-1_0-rt</taglib-uri> <taglib-location>/WEB-INF/tld/fmt-1_0-rt.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/core</taglib-uri> <taglib-location>/WEB-INF/tld/c.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/core-1_0-rt</taglib-uri> <taglib-location>/WEB-INF/tld/c-1_0-rt.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/core-1_0</taglib-uri> <taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri> <taglib-location>/WEB-INF/tld/sql.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/sql-1_0</taglib-uri> <taglib-location>/WEB-INF/tld/sql-1_0.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/sql-1_0-rt</taglib-uri> <taglib-location>/WEB-INF/tld/sql-1_0-rt.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/x</taglib-uri> <taglib-location>/WEB-INF/tld/x.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/x-1_0</taglib-uri> <taglib-location>/WEB-INF/tld/x-1_0.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/x-1_0-rt</taglib-uri> <taglib-location>/WEB-INF/tld/x-1_0-rt.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/fn</taglib-uri> <taglib-location>/WEB-INF/tld/fn.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/permittedTaglibs</taglib-uri> <taglib-location>/WEB-INF/tld/permittedTaglibs.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/scriptfree</taglib-uri> <taglib-location>/WEB-INF/tld/scriptfree.tld</taglib-location> </taglib> </web-app>?
6.建立一个名为test.jsp文件