Java学习12.07
图书馆管理系统——功能页
1、浏览图书信息
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <% 12 Object message = request.getAttribute("message"); 13 Object grade_list = request.getAttribute("grade_list"); 14 if(message!=null && !"".equals(message)){ 15 %> 16 <script type="text/javascript"> 17 alert("<%=request.getAttribute("message")%>"); 18 </script> 19 <%} %> 20 <div align="center"> 21 <h1 >信息列表</h1> 22 <h1> 23 <form action="Servlet?method=search" method="post"> 24 <select name="cxfs"> 25 <option id="cxfs"value ="1">作者名</option> 26 <option id="cxfs"value ="2">书名</option> 27 28 </select> 29 <input type="text" id="value" name="value" placeholder="请输入条件"> 30 <input type="submit" id="select" name="select" value="查询" /> 31 </form> 32 33 </h1> 34 <a href="reader.jsp">返回主页</a> 35 <table > 36 <tr> 37 <td>书籍编号</td> 38 <td>书名</td> 39 <td>作者</td> 40 <td>出版社</td> 41 <td>可借阅数量</td> 42 43 <td align="center" colspan="1">操作</td> 44 </tr> 45 <c:forEach items="${list}" var="item"> 46 <tr> 47 <td>${item.idBook}</td> 48 <td>${item.nameBook}</td> 49 <td>${item.nameWritter}</td> 50 <td>${item.namePress}</td> 51 <td>${item.number}</td> 52 53 54 <td><a href="Servlet?method=jieyue&id=${item.id}">借阅</a></td> 55 </tr> 56 </c:forEach> 57 </table> 58 </div> 59 </body> 60 61 </html>
2、管理员功能页
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>首页</title> 9 <style> 10 .a{ 11 font-size: 26px; 12 margin-top: 20px; 13 } 14 </style> 15 </head> 16 <body style="background-color: pink "> 17 <% 18 Object message = request.getAttribute("message"); 19 if(message!=null && !"".equals(message)){ 20 21 %> 22 <script type="text/javascript"> 23 alert("<%=request.getAttribute("message")%>"); 24 </script> 25 <%} %> 26 <div align="center"> 27 <h1 style="color: black;">管理员功能页</h1> 28 <div class="a"> 29 <a href="addpeople.jsp">增添读者</a> 30 </div> 31 <div class="a"> 32 <a href="addbook.jsp">增添新书</a> 33 </div> 34 <div class="a"> 35 <a href="printreturnbook.jsp">打印催还书目信息</a> 36 </div> 37 <div class="a"> 38 <a href="index.jsp">退出</a> 39 </div> 40 </div> 41 </body> 42 </html>
3、查询图书
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@page import="java.util.List" %> 4 <%@page import="bean.Book" %> 5 6 <!DOCTYPE html> 7 <html> 8 <head> 9 <meta charset="UTF-8"> 10 <title>Insert title here</title> 11 <link href="css/bootstrap.css" type="text/css" rel="stylesheet" /> 12 <script src="js/jquery-1.7.2.min.js"></script> 13 <script src="js/bootstrap.js"></script> 14 </head> 15 <style type="text/css"> 16 .button{ 17 width: 80px; 18 height: 30px; 19 background-color: green; 20 color: pink; 21 border: none; 22 border-radius: 5px; 23 font-size: 12px; 24 } 25 </style> 26 <script type="text/javascript"> 27 28 function load(){ 29 30 var name=document.getElementById("nameOfhouseholder").value; 31 alert(name); 32 $.ajax({ 33 type:"post", 34 url:"show?method=search", 35 data:{name:name}, 36 success: function(data){ 37 38 for(var i=0;i<data.length;i++){ 39 var tr; 40 tr='<td>'+data[i].idBook+'</td>' 41 +'<td>'+data[i].nameBook+'</td>' 42 +'<td>'+data[i].namePress+'</td>' 43 +'<td>'+data[i].nameWritter+'</td>' 44 +'<td>'+data[i].number+'</td>'; 45 46 /* +"<td><a href='Servlet?method=del&nameOfhouseholder="+data[i].nameOfhouseholder+"'><small>删除</small></td>"; */ 47 48 $("#listbook").append('<tr>'+tr+'</tr>') 49 } 50 51 }, 52 dataType:"json" 53 }); 54 } 55 function checkAll(){ 56 return true; 57 } 58 </script> 59 <body> 60 61 <h1>信息列表</h1> 62 <a href="reader.jsp">返回主页</a> 63 <form action="Servlet?method=search" method="post" onsubmit="return check()"> 64 <table class="table table-striped"> 65 66 <thead> 67 <tr> 68 <td colspan=5 align="center"> 书籍名称<input type="text" name="nameBook" id="nameBook" onblur="checkname()"></td> 69 </tr> 70 <tr> 71 72 <td colspan=5 align="center"><button class="button" type="submit" id="select" onclick="load()">查询</button></td> 73 </tr> 74 75 <tr> 76 77 <th scope="col">书籍编号</th> 78 <th scope="col">书名</th> 79 <th scope="col">作者</th> 80 <th scope="col">出版社</th> 81 <th scope="col">可借阅人数</th> 82 83 <!-- <th scope="col">操作</th> --> 84 </tr> 85 </thead> 86 <tbody id="list"> </tbody> 87 88 </table> 89 </form> 90 91 </body> 92 </html>
4、查询图书结果页面
<%@ page language="java" contentType="text/html; charse=tUTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>书籍信息显示页面</title> <link href="css/bootstrap.css" type="text/css" rel="stylesheet" /> <script src="js/jquery-1.7.2.min.js"></script> <script src="js/bootstrap.js"></script> </head> <% Object message=request.getAttribute("message"); if(message!=null&&!"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%}%> <script type="text/javascript"> /* function add() { location.href = "add.jsp"; } */ function load(){ $.ajax({ type:"post", url:"show?method=show", success: function(data){ $(data).each( function (i, values) { $("#list").append( "<tr><td>"+(++i)+"</td>" +"<td>"+values.nameBook+"</td>" +"<td>"+values.idBook+"</td>" +"<td>"+values.nameWritter+"平方米</td>" +"<td>"+values.namePress+"间</td>" +"<td>"+values.number+"</td>" /* +"<td><a href='oldServlet?method=del&pname=${data[i].name}'><small>删除</small></td>" */ ); }); }, dataType:"json" }); } function checkAll(){ return true; } window.onload=load </script> <body> <h1>信息列表</h1> <a href="reader.jsp">返回主页</a> <table class="table table-striped"> <thead> <tr> <th scope="col">书名</th> <th scope="col">书籍编号</th> <th scope="col">作者</th> <th scope="col">出版社 </th> <th scope="col">可借阅数量</th> </tr> </thead> <tbody id="list"> </tbody> </table> </body> </html>