使用EL和JSTL标签

1,使用EL表达式

      1,注意如果是使用Servlet 2.4 规范, EL 则默认是支持的。Servlet2.4的web.xml为:

      

<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">  

       2,如果使用的为Servlet2.3以前的规范,在必须在*.jsp中加入

   

<%@page isELIgnored="false"%> 

 

 

2,使用jstl表达式
        1,拷贝JSTL库下的*.lib到WEB-INF\lib下,拷贝JSTL库下的*.tld到  WEB-INF下
        2,修改web.xml文件,加入<tag>标签
<taglib>
     <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
     <taglib-location>/WEB-INF/fmt.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
     <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
     <taglib-location>/WEB-INF/c.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
     <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
     <taglib-location>/WEB-INF/sql.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
     <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
     <taglib-location>/WEB-INF/x.tld</taglib-location>
 </taglib> 
 <taglib>
     <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
     <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
 </taglib>   

          3,在*.jsp中加入tag:

   
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
      
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值