首先在pom.xml中引入依赖
<!-- jstl依赖 -->
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
在jsp上方加入语句
<!-- 导入jstl标签 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
然后就可以使用了,要注意pom中导入的依赖的groupid,我在maven仓库中找到的第一个引用后发现classNotFound。
附:循环代码
<c:forEach items="${list}" var="account">
<tr>
<td>${account.id}</td>
<td>${account.name}</td>
</tr>
</c:forEach>