📄 userimformation.jsp
字号:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'userimformation.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
<!--
body,td,th {
font-family: 仿宋_GB2312;
font-size: 18px;
color: #6600FF;
}
.style1 {
font-size: 24px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<%String driverName = "com.mysql.jdbc.Driver";
String userName = "root";
String userPasswd = "ptnest";
String url = "jdbc:mysql://127.0.0.1/bookstore?useUnicode=true&characterEncoding=gb2312";
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
System.out.print("数据库类没有找到" + e.getMessage());
}
Connection conn = DriverManager.getConnection(url, userName,userPasswd);
Statement stmt = conn.createStatement();
String userid=request.getParameter("BN");
int usid=Integer.parseInt(userid);
String sql = "select *from user where id='" + usid + "'";
String id="" ,name="", real_name="", email="",address="",content="",sex="";
int level=0;
int price=0;
try{
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
id = rs.getString("id");
name = rs.getString("name");
real_name = rs.getString("real_name");
email = rs.getString("email");
address = rs.getString("address");
content = rs.getString("content");
sex=rs.getString("sex");
//level=rs.getInt("level");
price=(int)rs.getDouble("history");
level=price/100;
}
rs.close();
}
catch(Exception e){}
%>
<table border=0 width=800 align=center>
<th height=40 colspan=2 bgcolor=ffc0cb>
<span class="style1">用户的详细信息</span>
</th>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>登录名称:</td>
<td><%=name%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>真实姓名:</td>
<td><%=real_name%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>电子邮件:</td>
<td><%=email%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>性 别:</td>
<td><%
if(sex.equals("1"))
out.print("女");
else
out.print("男");
%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>用户级别:</td>
<td><%=level%>级用户</td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>用户地址:</td>
<td><%=address%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>自我简介:</td>
<td><%=content%></td>
</tr>
</table>
<div align=center><font color=#FF0000><a href=/bookstore/admin/userlist.jsp>点击此处返回上级目录</a></font></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -