⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userinfo.jsp

📁 jsp+javabean写的论坛
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,com.alumni.bean.*"%>
<%
DBConnection dbConn=null;
Connection conn=null;
Statement stmt=null;
ResultSet info=null;

String username=null;
String password=null;
String realname=null;
String email=null;
String qq=null;
String msn=null;
String head=null;
String exp=null;
String regDate=null;
String adminClass=null;
String totalPub=null;
String totalVote=null;
String totalLogin=null;
String userID=null;
String loginUserID=null;

userID=request.getParameter("uid");
loginUserID=(String)session.getAttribute("userID");
if(loginUserID==null||loginUserID.equals(""))
{
	response.sendRedirect("login.jsp");
}
else
{
	if(userID==null||userID.equals(""))
	{
		response.sendRedirect("error.jsp?code=NoValueException");
	}
	else
	{
		dbConn=new DBConnection();
		conn=dbConn.getConnectionToAccess(application.getRealPath("/db/alumni.mdb"));
		stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
		String query="SELECT * FROM USERINFO WHERE ID="+userID;
		info=stmt.executeQuery(query);
		while(info.next())
		{
			username=info.getString("USERNAME");
			password=info.getString("PASSWORD");
			realname=info.getString("REALNAME");
			email=info.getString("EMAIL");
			qq=info.getString("QQ");
			msn=info.getString("MSN");
			head=info.getString("HEAD");
			exp=info.getString("EXP");
			regDate=info.getString("REG_DATE");
			adminClass=info.getString("ADMIN_CLASS");
			totalPub=info.getString("TOTAL_PUBLISH");
			totalVote=info.getString("TOTAL_VOTE");
			totalLogin=info.getString("TOTAL_LOGIN");
		}
	}
}
if(dbConn!=null)
{
	dbConn.close();
}

%>
<!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=gb2312">
<title>班级成员信息</title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript">
function changeImage()
{
	var pic=document.modifyForm.head.options[document.modifyForm.head.selectedIndex].value;
	document.all['headPic'].src="image/head/"+pic;
}
</script>
</head>
<body>
<jsp:include page="include/top.htm"/>
<%
if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
{
	out.print("<form action='/servlet/ModifyUserInfoServlet' method='post' enctype='multipart/form-data' name='modifyForm' target='_self' id='modifyForm'>");
}
%>
<table width="95%"  border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#000000">
  <tr>
    <td colspan="2" bgcolor="#99cc66">成员信息</td>
  </tr>
  <tr>
    <td width="100" bgcolor="#e7e7e7">注册用户名</td>
    <td bgcolor="#e7e7e7"><%=username%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">头像</td>
    <td bgcolor="#e7e7e7"><img src="<%=head%>" name="headPic" width="90" height="90" id="headPic">
		<div id="selectDefault">
		<%
		if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
		{
		%>
		<select name="head" id="head" onChange="changeImage()">
		<%
		for(int i=1;i<=23;i++)
		{
			if(i==1)
			{
				out.println("<option value="+i+".gif selected>"+i+".gif</option>");
			}
			else
			{
				out.println("<option value="+i+".gif>"+i+".gif</option>");
			}
		}
		%>
		</select>
		或者您可以上传自定义头像:
		<input name="file" type="file" size="30">
		<%}%>
	  </div>
	</td>
  </tr>
	<%
	if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
	{
		out.print("<tr>");
		out.print("<td bgcolor='#e7e7e7'>密码</td>");
		out.print("<td bgcolor='#e7e7e7'>");
		out.print("<input name='password' type='text' value='"+password+"' size='50' maxlength='50'>");
		out.print("</td>");
		out.print("</tr>");
	}
	%>
  <tr>
    <td bgcolor="#e7e7e7">真实姓名</td>
    <td bgcolor="#e7e7e7">
	<%
	if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
	{
		out.print("<input name='realname' type='text' value='"+realname+"' size='50' maxlength='50'>");
	}
	else
	{
		out.print(realname);
	}
	%>
	</td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">邮件地址</td>
	<td bgcolor="#e7e7e7">
	<%
	if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
	{
		out.print("<input name='email' type='text' value='"+email+"' size='50' maxlength='50'>");
	}
	else
	{
		out.print(email);
	}
	%>	</td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">QQ</td>
	<td bgcolor="#e7e7e7">
	<%
	if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
	{
		out.print("<input name='qq' type='text' value='"+qq+"' size='50' maxlength='50'>");
	}
	else
	{
		out.print(qq);
	}
	%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">MSN</td>
	<td bgcolor="#e7e7e7">
	<%
	if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
	{
		out.print("<input name='msn' type='text' value='"+msn+"' size='50' maxlength='50'>");
	}
	else
	{
		out.print(msn);
	}
	%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">经验值</td>
    <td bgcolor="#e7e7e7"><%=exp%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">注册日期</td>
    <td bgcolor="#e7e7e7"><%=regDate%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">权限</td>
    <td bgcolor="#e7e7e7"><%=adminClass%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">总发言</td>
    <td bgcolor="#e7e7e7"><%=totalPub%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">总投票</td>
    <td bgcolor="#e7e7e7"><%=totalVote%></td>
  </tr>
  <tr>
    <td bgcolor="#e7e7e7">总登陆</td>
    <td bgcolor="#e7e7e7"><%=totalLogin%></td>
  </tr>
</table>
<%
if(loginUserID!=null&&userID!=null&&loginUserID.equals(userID))
{
	out.print("<table width='95%'  border='0' align='center' cellpadding='5' cellspacing='1'>");
	out.print("<tr><td align='center'><input name='Submit' type='submit' value='修改个人信息'></td></tr>");
	out.print("</form>");
}
%>
<jsp:include page="include/bottom.htm"/>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -