本地使用JSTL标签的一些配置(Eclipse+Tomcat)

JSTL:JSP 标准标签库,可以编写没有java代码的jsp页面,有了它,基本上Java的代码就会变少,甚至没有,所以想用一些

一、下载jar包

因为这个东西不是原有的,所以一定要下载jar包才可以,

下载地址是:http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/

下载jakarta-taglibs-standard-1.1.1.zip这种.zip的文件,至于版本应该是都可以吧

二、jar包放到项目下

1、在jakarta-taglibs-standard-1.1.1\lib下找到jar包

2、把jar包放到项目的WebContent\WEB-INF\lib下

三、在web.xml里写配置信息

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
id="WebApp_ID" 
version="3.1"
metadata-complete="true">
  <display-name>RDWork</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <jsp-config>
  <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/core</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>http://java.sun.com/jstl/fn</taglib-uri>
  <taglib-location>/WEB-INF/fn.tld</taglib-location>
  </taglib>
  <taglib>    
  <taglib-uri>http://java.sun.com/jstl/perTag</taglib-uri>    
  <taglib-location>/WEB-INF/permittedTaglibs.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/script</taglib-uri>    
  <taglib-location>/WEB-INF/scriptfree.tld</taglib-location>  
  </taglib>   
  <taglib>    
  <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>    
  <taglib-location>/WEB-INF/x.tld</taglib-location>  
  </taglib>
  </jsp-config>
</web-app>

<jsp-config>...</jsp-config>一定要加并写对位置,否则会出现cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'.的问题,此处参考http://blog.csdn.net/lopper/article/details/4836252

四、把tld放到项目里

其查资料的时候这一步有人不需要,但是我的还是没有办法使用JSTL,但是要加进去就好了。

jakarta-taglibs-standard-1.1.1中文件夹下的tlb

放到WebContent\WEB-INF下

这样应该就不会有问题了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值