用户管理系统开发(用户信息显示)
接收登陆界面传参 确定用户 调用dao查询用户信息显示
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="bean.*" %>
<%@ page import="dao.*" %>
<%@ page import="java.util.ArrayList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset=utf-8");
String id=request.getParameter("UserID");
ArrayList<User> users=new UserDao().getAlluserinfos();
if(users==null){
users=new ArrayList<>();
}
%>
</head>
<body>
<div style="position:absolute;100%;height:100%;background:#7FDBFF;">
<h1>用户信息</h1>
<table border="1" >
<tr>
<th style="100px">UserID</th>
<th style="100px">UserName</th>
<th style="100px">sex</th>
<th style="100px">idNumber</th>
<th style="100px">Phone</th>
<th style="100px">User</th>
<th style="100px">Password</th>
<th style="100px">操作</th>
</tr>
<% for(User user:users){
if(user.get("UserID").equals(id)){
%>
<tr>
<td><%=user.get("UserID")%></td>
<td><%=user.get("UserName")%></td>
<td><%=user.get("sex")%></td>
<td><%=user.get("idNumber")%></td>
<td><%=user.get("Phone")%></td>
<td><%=user.get("User")%></td>
<td><%=user.get("Password")%></td>
<td><a href="xiugai.jsp?UserID=<%=user.get("UserID")%>&UserName=<%=user.get("UserName")%>&sex=<%=user.get("sex")%>&idNumber=<%=user.get("idNumber")%>&Phone=<%=user.get("Phone")%>&User=<%=user.get("User")%>&Password=<%=user.get("Password")%>">修改</a> <a href="UserServlet?method=del&UserID=<%=user.get("UserID")%>">删除</a></td>
</tr>
<%
}}
%>
</table>
</div>
</html>