JSP页面配置JSTL标签库

jar包官方下载地址:http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/

参考:http://www.runoob.com/jsp/jsp-jstl.html

第一步:将解压文件夹lib下的两个jar包放到项目的WEB-INF/lib下,并build path

第二步:配置web.xml文件,可以全部配,也可以有选择的配

<jsp-config>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/fmt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt-rt</taglib-uri>
    <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core-rt</taglib-uri>
    <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
    <taglib-location>/WEB-INF/sql.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/sql-rt</taglib-uri>
    <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/x</taglib-uri>
    <taglib-location>/WEB-INF/x.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/x-rt</taglib-uri>
    <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
    </taglib>
</jsp-config>

第三步:使用,在使用该库的jsp页面引入标签库

<!-- fmt标签 -->
<%
@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

 

页面引入jstl的c标签库

把第一步的两个jar包引入,在页面引入标签库即可。

<!-- c标签 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

 

posted @ 2019-03-26 09:36  !O0O!  阅读(184)  评论(0)    收藏  举报