我的一亩三分地

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  2 随笔 :: 14 文章 :: 3 评论 :: 0 Trackbacks

1 下载JSTL和Tomcat,可以在apache网站上下到
2 将下载到的JSTL压缩包解压,然后把其中的lib文件夹下的文件copy到具体应用WEB-INF/lib里,把tld目录copy到WEB-INF目录下
3
在web.xml文件中加入下面的语句:
<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-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-rt</taglib-uri>
    <taglib-location>/WEB-INF/tld/c-1_0-rt.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-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-rt</taglib-uri>
    <taglib-location>/WEB-INF/tld/x-1_0-rt.tld</taglib-location>
</taglib>

 

4 测试
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello JSTL</title>
</head>
<body>
<c:out value="Hello,JSTL!"/>
</body>

posted on 2007-01-23 16:13 王某某 阅读(2458) 评论(1)  编辑  收藏 所属分类: Web相关

评论

# re: 在Tomcat中配置JSTL 2007-01-28 17:24 王某某
在tomcat5.0以后可以不在web.xml里进行配置,使用jstl1.1以后的版本,uri应该写作http://java.sun.com/jsp/jstl/core。此外,还应该在tomcat的\common\endorsed目录下拷入xalan.jar文件。否则无法正确解析xml文件  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: