`
qiuzhiqing
  • 浏览: 7816 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
最近访客 更多访客>>
社区版块
存档分类
最新评论

JSTL学习笔记(一) ——JSTL配置

    博客分类:
  • java
阅读更多

JSP 标准标记库(JSP Standard Tag Library,JSTL)是一个实现 Web 应用程序中常见的通用功能的定制标记库集,这些功能包括迭代和条件判断、数据管理格式化、XML 操作以及数据库访问。

 

下面介绍一下web.xml的配置

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
 	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">
	<jsp-config>
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/fmt-rt.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/c-rt.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/sql.tld</taglib-location>
		</taglib>
		
		<taglib>
		     <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
                 <taglib-location>/WEB-INF/tlds/sql-rt.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/x.tld</taglib-location>
		</taglib>
		
		<taglib>
		    <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
		    <taglib-location>/WEB-INF/tlds/x-rt.tld</taglib-location>
		</taglib>
	</jsp-config>
</web-app>
  

 

分享到:
评论
9 楼 anzn20 2008-10-17  
anzn20 写道

linyang2903 写道
请问你用过jstl fn这个吗 为什么我在我项目里用不了 一用就说找不到相关方法 我用过。你必须引用到你的 页面里面去哈。

<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
8 楼 anzn20 2008-10-17  
linyang2903 写道

请问你用过jstl fn这个吗 为什么我在我项目里用不了 一用就说找不到相关方法

我用过。你必须引用到你的 页面里面去哈。
7 楼 linyang2903 2008-08-22  
请问你用过jstl fn这个吗 为什么我在我项目里用不了 一用就说找不到相关方法
6 楼 linyang2903 2008-08-22  
请问你用过jstl fn这个吗 为什么我在我项目里用不了 一用就说找不到相关方法
5 楼 suncjh 2008-03-31  
真的不错!以后可以节省不少时间!!
4 楼 qiuzhiqing 2008-02-02  
谢谢!
现在在看Struts2.0
发现2.0已经解决这个问题了
3 楼 keshin 2008-01-31  
JSTL与普通taglib的区别在于sun为其定义了一个专门的规范,由servletContainer的实现者实现这个规范,因此不需要在web.xml中另外定义,当然如果你要使用非默认的uri则需要在web.xml中定义了

以上内容也是摘的,不一定正确
2 楼 qiuzhiqing 2008-01-31  
具体实现能说一下么,我是刚入门的,谢谢了!
1 楼 keshin 2008-01-31  
不需要在web.xml中定义的
引用

In addition to declaring the tag libraries, tutorial examples access the JSTL API and implementation. In the Application Server, the JSTL TLDs and libraries are distributed in the archive <J2EE_HOME>/lib/appserv-jstl.jar. This library is automatically loaded into the classpath of all web applications running on the Application Server, so you don't need to add it to your web application.

以上摘自j2ee的tutorial

相关推荐

Global site tag (gtag.js) - Google Analytics