<%-- Created by IntelliJ IDEA. User: wangy Date: 2018/11/8 Time: 16:01 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %> <html> <head> <title>Title</title> </head> <body> <%=exception.getMessage()%> </body> </html>
update.jsp 修改员工信息页面
%-- Created by IntelliJ IDEA. User: wangy Date: 2018/11/8 Time: 15:27 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>员工更新页面</title> </head> <body> <h3>当前访问量:<%=application.getAttribute("count")%></h3> <h3>员工更新页面</h3> <%--获取session中的值并显示到页面上--%> <h3>登录账户:<%=session.getAttribute("account")%></h3> <hr> <form action="update-control.jsp"> <table> <tr> <%--value="<%=request.getParameter("account")%>"可用于实现数据的回显--%> <td>账号</td> <td><input type="text" value="<%=request.getParameter("account")%>"></td> </tr> <tr> <td>姓名</td> <td><input type="text" value="<%=request.getParameter("name")%>"></td> </tr> <tr> <td>邮箱</td> <td><input type="text" value="<%=request.getParameter("email")%>"></td> </tr> <tr> <td> <input type="submit" value="修改"> </td> </tr> </table> </form> </body> </html>
update-control 执行修改操作的控制页面
<%-- Created by IntelliJ IDEA. User: wangy Date: 2018/11/9 Time: 9:46 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@page import="org.wang.db.*,org.wang.model.*" %> <%@ page import="java.util.Map" %> <html> <head> <title>Title</title> </head> <body> <% //获取map集合 Map<String,Emp> map = DBUtil.map; //修改信息 //获取当前需要修改的员工的account Emp emp = map.get(request.getParameter("account")); //把获取到的当前员工的信息重新set emp.setName(request.getParameter("name")); emp.setEmail(request.getParameter("email")); %> <h3>修改员工信息成功</h3> </body> </html>
运行效果
登录界面
登录成功后进入员工信息显示页面
修改员工信息(这里用了数据回显)