数据库程序设计第八天--隔离人员权限
一、说在前面
今天目标是完成隔离人员对自身信息的查看和个人信息的更改的操作。
二、任务进度
package Servlet; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import Bean.LoginBean; import Bean.PersonBean; import Dao.IPDao; import Dao.LoginDao; /** * Servlet implementation class PeopleShowServlet */ @WebServlet("/peopleShowServlet") public class PeopleShowServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public PeopleShowServlet() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); List<PersonBean> list=new ArrayList(); IPDao dao=new IPDao(); list=dao.list(); request.setAttribute("list", list); request.getRequestDispatcher("personShow.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
package Servlet; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import Bean.PersonBean; import Dao.IPDao; /** * Servlet implementation class PersonalMessegShow */ @WebServlet("/personalMessegShow") public class PersonalMessegShow extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public PersonalMessegShow() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); List<PersonBean> list=new ArrayList(); String pname=request.getParameter("pname"); IPDao dao=new IPDao(); list=dao.listP(pname); request.setAttribute("list", list); request.getRequestDispatcher("personalMessegShow.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
<%@ 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"> <link rel="stylesheet" href="layui/layui.css" > <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="layui/layui.js"></script> <script src="layui/layui.all.js"></script> <title>用户管理</title> </head> <body> <% Object message = request.getAttribute("message"); Object list =request.getAttribute("list"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <% } %> <table class="layui-table"> <colgroup> <col width="50"> <col width="150"> <col width="90"> <col width="150"> </colgroup> <thead> <tr> <th>PID</th> <th>姓名</th> <th>性别</th> <th>出生日期</th> </tr> </thead> <tbody> <c:forEach var="item" items="${list}"> <tr> <td>${item.pid}</td> <td>${item.pname}</td> <td>${item.sex}</td> <td>${item.birth}</td> </tr> </c:forEach> </tbody> </table> </body> </html>
<%@ 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"> <link rel="stylesheet" href="layui/layui.css" > <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="layui/layui.js"></script> <script src="layui/layui.all.js"></script> <title>用户管理</title> </head> <body> <% Object message = request.getAttribute("message"); Object list =request.getAttribute("list"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <% } %> <table class="layui-table"> <colgroup> <col width="50"> <col width="150"> <col width="90"> <col width="150"> <col width="150"> <col width="150"> <col width="150"> <col width="150"> <col width="150"> </colgroup> <thead> <tr> <th>PID/WID</th> <th>姓名</th> <th>性别</th> <th>出生日期</th> <th>隔离日期</th> <th>结束日期</th> <th>隔离地</th> <th>来源地</th> <th>备注</th> </tr> </thead> <tbody> <c:forEach var="item" items="${list}"> <tr> <td>${item.pid}/${item.wid}</td> <td>${item.pname}</td> <td>${item.sex}</td> <td>${item.birth}</td> <td>${item.startday}</td> <td>${item.endday}</td> <td>${item.wname}</td> <td>${item.from}</td> <td>${item.eg}</td> </tr> </c:forEach> </tbody> </table> </body> </html>