IDEA创建Java EE项目,使用Spring + Spring MVC + MyBatis框架,使用maven管理依赖。项目当前的环境是:
- Tomat 10.1.28
- Maven 3.6.3
- JDK 17
项目的功能:读取数据库的report表中的数据,返回一个List集合对象reportList在JSP页面上,使用EL表达式+JSTL标签库,遍历集合,显示每一条report信息。
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
</head>
<body>
<h3>欢迎登录,${sessionScope.get("user").name}</h3>
<div>
<table>
<c:forEach items="${reportList}" var="report">
<tr>
<td>报告编号:</td><td>${report.id}</td>
<td>报告名称:</td><td>${report.reportName}</td>
<td>报告内容:</td><td>${report.reportContext}</td>
<td>报告截止提交日期:</td><td>${report.deadlineTime}</td>
</tr>
</c:forEach>
</table>
</div>
</body>
</html>
EL表达式和JSTL标签的使用,需要再项目的pom.xml文件引入了一下依赖
<!-- 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


693

被折叠的 条评论
为什么被折叠?



