Standard way of adding JSLT 1.2.1 in a Maven Project?

后端 未结 1 1417
遥遥无期
遥遥无期 2020-12-04 03:45

What is the standard pom for adding the 1.2.1 JSTL taglib in a maven project. Any recommendations as to when/if can this be scoped as provide

相关标签:
1条回答
  • 2020-12-04 04:14

    Ended up using :

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- Add the jstl-api dependency explicitly - otherwise jstl-api 1.2 is added -->
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>javax.servlet.jsp.jstl-api</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>javax.servlet.jsp.jstl</artifactId>
        <version>1.2.1</version>
        <exclusions>
             <!-- jstl-api was adding selvlet-api 2.5 and jsp-api-->
            <exclusion>
                <artifactId>jstl-api</artifactId>
                <groupId>javax.servlet.jsp.jstl</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    

    Not sure if I should add the jstl-api dependency - please comment (I would accept a more authoritative answer actually). Result:

    enter image description here

    See:

    • Autocomplete with JSP, JSTL 1.2.1 and Servlet 3.0 in Tomcat 7 with Eclipse Kepler
    • Fix maven JSTL 1.2.1 dependency so maven-war-plugin doesn't package JARs that offend Tomcat 7
    • JBoss 7.1 - Migration to JSF 2.2 - includes how to upgrate your jstl to 1.2.1

    For 1.2:

    • Running JSTL 1.2 on Tomcat 7 using Maven
    0 讨论(0)
提交回复
热议问题