add.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加信息</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
</style>
</head>
<body>
 <%
      Object message = request.getAttribute("message");
      if(message!=null && !"".equals(message)){
 
 %>
      <script type="text/javascript">
           alert("<%=request.getAttribute("message")%>");
      </script>
 <%} %>
 <div align="center">
  <h1 style="color: blue;">添加信息</h1>
  <a href="index.jsp">返回主页</a>
  <form action="servlet method=add" method="post" onsubmit="return check()">
   <div class="a">
    姓名<input type="text" id="name" name="name"/>
   </div>
   <div class="a">
    分数<input type="text" id="grade" name="grade" />
   </div>
  </form>
 </div>
 <script type="text/javascript">
  function check()
  {
   var name = document.getElementById("name");;
   var grade = document.getElementById("grade");
   
   //判断是否空
   if(name.value == '')
   {
    alert('名字为空');
    name.focus();
    return false;
   }
   
   if(grade.value == '')
   {
    alert('分数为空');
    place.focus();
    return false;
   }
  }
  
 </script>
</body>
</html>
 
del.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>删除</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
</style>
</head>
<body>
 <%
      Object message = request.getAttribute("message");
      if(message!=null && !"".equals(message)){
 
 %>
      <script type="text/javascript">
           alert("<%=request.getAttribute("message")%>");
      </script>
 <%} %>
 <div align="center">
  <h1 style="color: blue;">信息删除</h1>
  <a href="index.jsp">返回主页</a>
  <form action="servlet?method=getcoursebyname" method="post" onsubmit="return check()">
   <div class="a">
    姓名<input type="text" id="name" name="name"/>
   </div>
   <div class="a">
    <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;找</button>
   </div>
  </form>
 </div>
 <script type="text/javascript">
  function check()
  {
   var name = document.getElementById("name");
   
   //非空
   if(name.value == '')
   {
    alert('姓名为空');
    name.focus();
    return false;
   }
  }
 </script>
</body>
</html>
 
detail.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>按ID查询</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
 .tb, td {
  border: 1px solid black;
  font-size: 22px;
 }
</style>
</head>
<body>
 <div align="center">
  <h1 style="color: blue;">信息删除</h1>
  <a href="index.jsp">返回主页</a>
  <table class="tb">
   <tr>
    <td>姓名</td>
    <td>${course.name}</td>
   </tr>
   <tr>
    <td>分数</td>
    <td>${course.grade}</td>
   </tr>
  </table>
  <div class="a">
   <a onclick="return check()" href="servlet?method=del&id=${course.id}">删&nbsp;&nbsp;&nbsp;除</a>
  </div>
 </div>
 <script type="text/javascript">
  function check() {
   if (confirm("真的要删除吗?"))
   {
    return true;
   }
   else
   {
    return false;
   }
  }
 </script>
</body>
</html>
 
detail2.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>按名字查询</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
</style>
</head>
<body>
 <%
      Object message = request.getAttribute("message");
      if(message!=null && !"".equals(message)){
 
 %>
      <script type="text/javascript">
           alert("<%=request.getAttribute("message")%>");
      </script>
 <%} %>
 <div align="center">
  <h1 style="color: red;">物资信息修改</h1>
  <a href="index.jsp">返回主页</a>
  <form action="CourseServlet?method=update" method="post" onsubmit="return check()">
   <div class="a">
    姓名<input type="text" id="name" name="name" value="${course.name}"/>
   </div>
   <div class="a">
    分数<input type="text" id="grade" name="grade" value="${course.grade}"/>
   </div>
   <input type="hidden" id="id" name="id" value="${course.id}"/>
   <div class="a">
    <button type="submit" class="b">修&nbsp;&nbsp;&nbsp;改</button>
   </div>
  </form>
 </div>
 <script type="text/javascript">
  function check()
  {
   var name = document.getElementById("name");;
   var grade = document.getElementById("grade");
   
   //非空
   if(name.value == '')
   {
    alert('姓名为空');
    name.focus();
    return false;
   }
   
   if(grade.value == '')
   {
    alert('分数为空');
    place.focus();
    return false;
   }
   
  }
 </script>
</body>
</html>
 
index.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
<style>
 .a{
  font-size: 26px;
  margin-top: 20px;
 }
</style>
</head>
<body>
 <div align="center">
  <h1 style="color: blue;">查分系统</h1>
  <div class="a">
   <a href="add.jsp">添加信息</a>
  </div>
  <div class="a">
   <a href="servlet?method=list">信息修改</a>
  </div>
  <div class="a">
   <a href="del.jsp">信息删除</a>
  </div>
  <div class="a">
   <a href="search.jsp">信息搜索</a>
  </div>
 </div>
</body>
</html>
 
list.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>遍历</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
 .tb, td {
  border: 1px solid black;
  font-size: 22px;
 }
</style>
</head>
<body>
 <%
      Object message = request.getAttribute("message");
      if(message!=null && !"".equals(message)){
 
 %>
      <script type="text/javascript">
           alert("<%=request.getAttribute("message")%>");
      </script>
 <%} %>
 <div align="center">
  <h1 style="color: red;">信息列表</h1>
  <a href="index.jsp">返回主页</a>
  <table class="tb">
   <tr>
    <td>id</td>
    <td>姓名</td>
    <td>分数</td>
    <td align="center" colspan="2">操作</td>
   </tr>
   <c:forEach items="${courses}" var="item">
    <tr>
     <td>${item.id}</td>
     <td>${item.name}</td>
     <td>${item.grade}</td>
     <td><a href="servlet?method=getCourseById&id=${item.id}">修改</a></td>
    </tr>
   </c:forEach>
  </table>
 </div>
</body>
</html>
 
search.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>搜索</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
</style>
</head>
<body>
 <div align="center">
  <h1 style="color: blue;">物资信息查询</h1>
  <a href="index.jsp">返回主页</a>
  <form action="servlet?method=search" method="post" onsubmit="return check()">
   <div class="a">
    姓名<input type="text" id="name" name="name"/>
   </div>
   <div class="a">
    分数<input type="text" id="grade" name="grade" />
   </div>
   <div class="a">
    <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;询</button>
   </div>
  </form>
 </div>
 <script type="text/javascript">
  function check()
  {
   var name = document.getElementById("name");;
   var grade = document.getElementById("grade");
   
   //非空
   if(name.value == '' && grade.value == '' )
   {
    alert('请填写一个条件');
    return false;
   }
  }
 </script>
</body>
</html>
 
searchlist.jsp
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
 .a{
  margin-top: 20px;
 }
 .b{
  font-size: 20px;
  width: 160px;
  color: white;
  background-color: greenyellow;
 }
 .tb, td {
  border: 1px solid black;
  font-size: 22px;
 }
</style>
</head>
<body>
 <div align="center">
  <h1 style="color: red;">信息列表</h1>
  <a href="index.jsp">返回主页</a>
  <table class="tb">
   <tr>
    <td>id</td>
    <td>姓名</td>
    <td>分数</td>
   </tr>
   <!-- forEach遍历出adminBeans -->
   <c:forEach items="${courses}" var="item" varStatus="status">
    <tr>
     <td>${item.id}</td>
     <td><a>${item.name}</a></td>
     <td>${item.grade}</td>
    </tr>
   </c:forEach>
  </table>
 </div>
</body>
</html>
 
jsp部分

最新文章

  1. js的一些属性
  2. [BTS] The value &quot;&quot; for the property InboundId is invalid
  3. java equals 和 &quot;==&quot; 比较
  4. HLS视频直播
  5. 在linux终端下打开pdf文件
  6. 更改cmd代码页,修正语言显示
  7. oracle数据库表空间及归档
  8. PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this sy
  9. Java学习之InputStream中read()与read(byte[] b)
  10. virus.win32.parite.H查杀病毒的方法
  11. CodeForces 710C Magic Odd Square
  12. Tomcat服务器的配置
  13. 计算1-1/3+1/5-1/7+&#183;&#183;&#183;的前n项和
  14. CocosCreator检测动作执行完毕的方法~之一吧,应该= =
  15. pytorch中tensorboardX的用法
  16. [转]win10中安装JDK8以及环境配置
  17. 史上最全python面试题详解 (二)(附带详细答案(关注、持续更新))
  18. android 读取EXcel 文件 读取文件内存卡的权限
  19. JSON格式说明
  20. android开发(3):列表listview的实现 | 下拉刷新

热门文章

  1. nfs 笔记
  2. Java中多线程重复启动
  3. webConfig详细跳转配置.[转]
  4. (五)多点触控之兼容ViewPager
  5. PHP-------ajax返回值 返回JSON 数据
  6. POJ 3264 Balanced Lineup 【ST表 静态RMQ】
  7. HDU 1029 Ignatius and the Princess IV (map的使用)
  8. EF Core 2.0中Transaction事务会对DbContext底层创建和关闭数据库连接的行为有所影响
  9. Office365学习笔记—获取当前用户
  10. iOS 自定义任意形状加载进度条(水波纹进度条)