servlet各个版本支持jstl

最近在做一个java web的项目,发现不同的servlet版本下要支持jstl依赖的jar包是不同的,现在记录下,以免忘记。

Java  EE版本介绍

Different versions of JEE:

Note: JPE (Java Professional Edition) project announced in May 1998 at Sun Microsystems.

VersionReleased in     
JEE2 (J2EE 1.2)12 Dec 1999Servlet 2.2JSP 1.1   
JEE3 (J2EE 1.3)24 Sep 2001Servlet 2.3JSP 1.2 JSTL 1.0 
JEE4 (J2EE 1.4)11 Nov 2003Servlet 2.4JSP 2.0 JSTL 1.1JSF1.1
JEE511 May 2006Servlet 2.5JSP 2.1EL2.1JSTL 1.2JSF 1.2
JEE610 Dec 2009Servlet 3.0JSP 2.2EL 2.2JSTL 1.2JSF 2.0
JEE712 Jun 2013Servlet 3.1JSP 2.3EL 3.0JSTL 1.2JSF 2.2

JEE and TOMCAT:

Lets only look at servlet and JSP versions in JEE as it compares to in TOMCAT.

JEE VersionTOMCAT Version
JEE3 implements Servlet 2.3 and JSP 1.2Tomcat 4 supports the same (Servlet 2.3 and JSP 1.2)
JEE4 implements Servlet 2.4 and JSP 2.0Tomcat 5 supports the same
JEE5 implements Servlet 2.5, JSP 2.1, JSTL 1.2, JSF 1.2Tomcat 6 supports Servlet 2.5, JSP 2.1 only. No JSTL. No JSF
JEE6 implements Servlet 3.0, JSP 2.2, EL 2.2, JSTL 1.2, JSF 2.0Tomcat 7 supports Servlet 3.0, JSP 2.2, EL 2.2 as well

Servlet各个版本使用jstl

Servlet 2.4

web.xml中的scheme定义
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
maven中的依赖
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.2</version>
    </dependency>

    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>

Servlet 2.5

web.xml中的scheme定义
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
  id="WebApp_ID" version="2.5">
maven中的依赖
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

Servlet 3.0

web.xml中的scheme定义
<web-app 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 
maven中的依赖(来自于 http://www.murraywilliams.com/2011/11/running-jstl-1-2-on-tomcat-7-using-maven/
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jstl-impl</artifactId>
    <version>1.2</version>
    <exclusions>
        <exclusion>
            <artifactId>servlet-api</artifactId>
            <groupId>javax.servlet</groupId>
        </exclusion>
        <exclusion>
            <artifactId>jsp-api</artifactId>
            <groupId>javax.servlet.jsp</groupId>
        </exclusion>
        <exclusion>
            <artifactId>jstl-api</artifactId>
            <groupId>javax.servlet.jsp.jstl</groupId>
        </exclusion>
    </exclusions>
</dependency>




版权声明:本文为StormrageWang原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。