123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <%@ page import="com.xbw.repository.StudentRepository" %>
- <%@ page import="com.xbw.entity.Student" %>
- <%@ page import="java.util.List" %>
- <%@ page import="java.util.ArrayList" %><%--
- Created by IntelliJ IDEA.
- User: x'b'w
- Date: 2021/5/23
- Time: 11:28
- 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>
- <%-- 查询OK--%>
- <form action="student1" method="get">
- 查询学号为<input type="text" name="selectnum">的同学的名字:<input type="text" name="selectname" readonly value="暂不开放!">
- <input type="submit" value="查询"><br>
- <input type="hidden" name="method" value="select" />
- </form>
- <%-- 修改OK--%>
- <form action="student1" method="post">
- 修改学号为<input type="text" name="updatenum">的同学的名字为:<input type="text" name="updatename"><input type="submit" value="修改"><br>
- <input type="hidden" name="method" value="update"/>
- </form>
- <%-- 增加OK--%>
- <form action="student1" method="post">
- 增加学号为<input type="text" name="addnum">的同学的名字为:<input type="text" name="addname"><input type="submit" value="增加"><br>
- <input type="hidden" name="method" value="add"/>
- </form>
- <%-- 删除OK--%>
- <form action="student1" method="get">
- 删除学号为<input type="text" name="deletenum">的同学的名字为:<input type="text" name="deletename" readonly value="暂不开放!">
- <input type="submit" value="删除"><br>
- <input type="hidden" name="method" value="delete"/>
- </form>
- <%-- 查询所有-------------------------------------------------------------------------------------------------------%>
- <form action="student1" method="get">
- <input type="submit" value="查询所有">
- </form>
- <%-- 查询所有信息:${list}--%>
- <table>
- <%-- <tr>--%>
- <%-- <th>编号</th>--%>
- <%-- <th>姓名</th>--%>
- <%-- </tr>--%>
- <%-- <tr>--%>
- <%-- <td>编号</td>--%>
- <%-- <td>姓名</td>--%>
- <%-- </tr>--%>
- <br>
- <%-- 查询一条信息:${resnum}--%>
- <br>
- <table>
- <c:choose>
- <c:when test="${resnum != null}">
- 查询一条信息:
- ${resnum}
- <tr>
- <td>${resnum.num}</td>
- <td>${resnum.name}</td>
- </tr>
- </c:when>
- <c:otherwise>
- 查无一条信息:null.
- </c:otherwise>
- </c:choose>
- </table>
- <br>
- <table>
- <c:choose>
- <c:when test="${list != null}">
- 全部信息:
- ${list}
- <c:forEach items="${list}" var="student1">
- <tr>
- <td>${student1.num}</td>
- <td>${student1.name}</td>
- </tr>
- </c:forEach>
- </c:when>
- <c:otherwise>
- 查无全部信息:null.
- </c:otherwise>
- </c:choose>
- </table>
- <%-- <%--%>
- <%-- String sel =(String) request.getAttribute("resnum");--%>
- <%-- if (sel != null){--%>
- <%-- %>--%>
- <%-- <%=--%>
- <%-- "当前查询的语句为"+sel--%>
- <%-- %>--%>
- <%-- <%--%>
- <%-- }else {--%>
- <%-- %>--%>
- <%-- <%=--%>
- <%-- "当前查询不到语句:null"--%>
- <%-- %>--%>
- </table>
- </body>
- </html>
|