JSTL版本分析

一、前言

  JSTL(JSP Standard Tag Library,JSP标准标签库)是一个不断完善的开放源代码的JSP标签库,是由apache的jakarta小组来维护的。然而jakarta有很多子项目如Tomcat、Lucene升级为Apache子项目,当前Jakarta无剩余的子项目,Jakarta项目于2011年12月21日退役。

  我需要利用Maven构建项目,此时需要使用到JSTL,但是我看到网上的一些教程,都是复制jar包到编译路径下。而这些jar包我却在Maven仓库中查不到,很是郁闷,而且查到JSTL的POM配置有些怪异,因此在这里进行整理一下。

官网:http://tomcat.apache.org/taglibs/ 

JSTL与Servlet&JSP版本对照图(官网)

  分析:我发现1.0与1.1没有在Maven仓库中存在,而且其使用方式都是将jstl.jar与standard.jar添加到编译路径下,并将tld文件夹中的文件(或者包含文件夹)复制到/WEB-INF,然后配置web.xml文件;而1.2就不一样了。再往下我是对各个版本README文件进行分析,如果没兴趣可以直接看第二段落

1.1 JSTL 1.0

README文件(部分)

The following two files are standalone web applications (WARs) that are
designed to work out of the box in order to help you learn JSTL:
   standard-doc.war                Documentation
   standard-examples.war           Simple examples of JSTL tags

To use this distribution with your own web applications, simply copy the JAR
files in the 'lib' directory to your application's WEB-INF/lib directory.
Then, import JSTL into your pages with the following directives:
  CORE LIBRARY
    EL:  <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    RT:  <%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %>
  XML LIBRARY
    EL:  <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    RT:  <%@ taglib prefix="x_rt" uri="http://java.sun.com/jstl/xml_rt" %>
  FMT LIBRARY 
    EL:  <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    RT:  <%@ taglib prefix="fmt_rt" uri="http://java.sun.com/jstl/fmt_rt" %>
  SQL LIBRARY
    EL:  <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    RT:  <%@ taglib prefix="sql_rt" uri="http://java.sun.com/jstl/sql_rt" %>
COMPATIBILITY

  前面讲的是这两个*.war文件都是一个示例项目,可以帮助我们学习JSTL。紧随其后就是使用方式,

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值