14、编写前端页面
先给出结构目录:
在webapp下的index.jsp页面写入两个链接地址
index.jsp内容:
<%@page contentType="text/html;charset=utf-8"%>
<html>
<body>
<h2>Hello World!</h2>
<a href="stu/findStu">学生信息</a>
<a href="classes/findClasses">班级信息</a>
</body>
</html>
14.1、在views下编写showClasses.jsp页面
<%--
Created by IntelliJ IDEA.
User: qrs-ljy
Date: 2022/8/30
Time: 18:01
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>班级信息</title>
</head>
<body>
<form action="addClasses" method="post">
班级名称:<input type="text" name="className"><br>
开班日期:<input type="text" name="createDate"><br>
班级人数:<input type="text" name="stuCount"><br>
<input type="submit" value="添加班级"><br>
</form>
${msg}
<hr>
<table border="1">
<c:forEach items="claList" var="cla">
<tr>
<td>${cla.classId}</td>
<td>${cla.className}</td>
<td>${cla.createDate}</td>
<td>${cla.stuCount}</td>
</tr>
</table>
</body>
</html>
14.2、在views下编写showStu.jsp页面
<%--
Created by IntelliJ IDEA.
User: qrs-ljy
Date: 2022/8/30
Time: 17:29
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>学生信息</title>
</head>
<body>
<form action="addStu" method="post">
姓名:<input type="text" name="stuName"><br>
住址:<input type="text" name="stuAddress"><br>
班级:<input type="text" name="fkClassId"><br>
<input type="submit" value="添加学生"><br>
</form>
${msg}
<hr>
<table border="1">
<c:forEach items="list" var="stu"/>
<tr>
<td>${stu.stuId}</td>
<td>${stu.stuName}</td>
<td>${stu.stuAddress}</td>
<td>${stu.fkClassId}</td>
</tr>
</table>
</body>
</html>
15、以上就完成了项目多有的代码,开始部署tomcat
(提示3写错单词了,该是ssm war exploded,尴尬)