springMVC-spring-Hibernate 开发学生管理系统简单案例-jsp文件说明(五)

五、jsp文件说明

源文件:https://download.csdn.net/download/flyingshadower/10628472

(1)jsp文件如图:

(2)addPage.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>
</head>
<body>
<jsp:include page="public.jsp"></jsp:include>
<h3>新增人员:</h3>
<br/>
<form action="/student/saveStudent" method="post">
    <table>
        <tr>
            <td>姓名:</td>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <td>学号:</td>
            <td><input type="text" name="number"></td>
        </tr>
        <tr>
            <td>分数:</td>
            <td><input type="text" name="score"></td>
        </tr>
    </table>
    <button type="submit" >添加</button>
    <button ><a href="javascript:history.go(-1)" style="text-decoration: none">返回</a></button>
</form>
</body>
</html>

(3)editPage.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>
</head>
<body>
<jsp:include page="public.jsp"></jsp:include>
<h3>修改信息:</h3>
<br/>
<form action="/student/updateStudent" method="post">
    <table>
        <tr>
            <td>id编号:</td>
            <td><input type="text" name="id" value="${studentEntity.studentId}" readonly></td>
        </tr>
        <tr>
            <td>姓名:</td>
            <td><input type="text" name="name" value="${studentEntity.studentName}"></td>
        </tr>
        <tr>
            <td>学号:</td>
            <td><input type="text" name="number"value="${studentEntity.studentNumber}"></td>
        </tr>
        <tr>
            <td>分数:</td>
            <td><input type="text" name="score" value="${studentEntity.studentScore}"></td>
        </tr>
    </table>
    <button type="submit" >更新</button>
    <button ><a href="javascript:history.go(-1)" style="text-decoration: none">返回</a></button>
</form>
</body>
</html>

(4)fail.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>
</head>
<body>
<h3>账号或密码错误!</h3>
<br>
<button><a href="/student/toLogin" style="text-decoration: none">重新登录</a></button>
</body>
</html>

(5)index.jsp

<%@ 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>
<jsp:include page="public.jsp"></jsp:include>
</body>
</html>

(6)login.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>
</head>
<body>
<form action="/student/login" method="post">
    账号:
    <input name="userId" type="text" placeholder="输入账号" >
    密码:
    <input  name="userPassword" type="password" placeholder="输入密码">
    <button type="submit">登录</button>
</form>
</body>
</html>

(7)main.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>
</head>
<body>
<jsp:include page="public.jsp"></jsp:include>
<h3>学生列表:</h3>
<a href="/student/addStudent" style="text-decoration: none">添加新学生</a>
<br/>
<br/>
<div>
    <table border="2">
        <thead>
        <tr>
            <th width="100">姓名</th>
            <th width="150">学号</th>
            <th width="100">分数</th>
            <th width="100">编辑</th>
            <th width="100">删除</th>
        </tr>
        </thead>
        <tbody align="center">
        <c:forEach var="stu" items="${studentList}">
            <tr>
                <td>${stu.studentName}</td>
                <td>${stu.studentNumber}</td>
                <td>${stu.studentScore}</td>
                <td><a href="/student/editStudent?id=${stu.studentId}" style="text-decoration: none" >修改</a></td>
                <td><a href="/student/deleteStudent?id=${stu.studentId}" style="text-decoration: none" >删除</a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</body>
</html>

(8)public.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h2 align="center">学生管理系统</h2>
<ul>
    <li><a href="/student/toIndex" style="text-decoration: none">首页</a></li>
    <li><a href="/student/main" style="text-decoration: none">学生列表:</a></li>
    <li><a href="/student/addStudent"style="text-decoration: none" >新增人员:</a></li>
    <li><a href="/student/toLogin"style="text-decoration: none">退出登录</a></li>
</ul>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/flyingshadower/article/details/82107875