springmvc使用JSTL标签库

时间:2022-04-22 08:35:10

今天使用SpringMvc,在页面上用JSTL来做标签库进行解析,方法是:

在JSP页面上引入<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

在pom.xml中引入JAR包:

            <dependency>  
                <groupId>javax.servlet</groupId>  
                <artifactId>jstl</artifactId>  
                <version>1.2</version>  
                <scope>runtime</scope>  
            </dependency> 
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>

注意不要引错包,不要写成

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

也不要servlet-api.jar jsp-api.jar这些jar包