servlet各个版本支持jstl

来源:互联网 发布:礼物说app源码 编辑:程序博客网 时间:2024/04/29 15:17

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

Java  EE版本介绍

此章节内容来自于http://www.javasprint.com/java_training_tutorial_blog/java_jee_versions_jsp_servlet_story_jsf_jstl_el_history.htm和http://en.wikipedia.org/wiki/Java_EE_version_history

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.1JEE511 May 2006Servlet 2.5JSP 2.1EL2.1JSTL 1.2JSF 1.2JEE610 Dec 2009Servlet 3.0JSP 2.2EL 2.2JSTL 1.2JSF 2.0JEE712 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 VersionJEE3 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 sameJEE5 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 JSFJEE6 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>



0 0