使用jstl表达式配置

来源:互联网 发布:手机建模 软件 编辑:程序博客网 时间:2024/05/12 05:18

jstl表达式配置

前段与后端动态交换数据用到了el表达式,但el表达式没有流程控制,这时jstl就起到了补充作用,应为他有<c:forEach>,<c:if>等控制语句,但使用jstl语句需要进行三个地方的配置:(这个只为以后忘记了回头来看)

一.web.xml中配置 

<!-- jstl配置 -->  <jsp-config>    <taglib>      <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>      <taglib-location>classpath*:/c.tld</taglib-location>    </taglib>  </jsp-config>

二.pom.xml中配置 

在</dependencies>标签里配置如下两个依赖包

<!-- jstl配置信息 --><dependency><groupId>taglibs</groupId><artifactId>standard</artifactId><version>1.1.2</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency>

三.在你用到jstl语句的jsp文件的头部加上如下信息

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

完成了这三步才能使用jstl语句。

1 0
原创粉丝点击