?? userinf.jsp.htm
字號:
<%@page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.*,java.sql.*,java.text.DateFormat,java.net.*"%>
<html>
<head>
<title>用戶信息板塊列表</title>
</head>
<body>
<%//防止某些用戶不進行登陸,直接想進入此頁面
if (session.getAttribute("username")==null){
response.sendRedirect("login1.jsp");
}%>
<%
String username=(String)session.getAttribute("username");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
out.print(e);
}
String strDirPath=application.getRealPath(request.getRequestURI());
strDirPath=strDirPath.substring(0,strDirPath.lastIndexOf('\\'))+"\\";
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+strDirPath+"forum.mdb";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
String sql="";
sql="select * from User where UserName='"+username+"'";
ResultSet rs=stmt.executeQuery(sql); //執行查詢操作
rs.next();
%>
<table width="90%" align="center" cellpadding="3" cellspacing="1">
<tr>
<td colspan="2" bgcolor="#009933">      用戶 <%=username%>
    <a href="javascript:history.back();">返回</a>
</td>
</tr>
<form name="myform" method="post" action="mod.jsp?userneme=<%=username%>" OnSubmit="return checkdata();">
<tr>
<td bgcolor="#efefef" width="37%">編號</td>
<td bgcolor="#efefef" width="63%">
<%=rs.getString("ID")%>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">用戶名</td>
<td bgcolor="#efefef" width="63%">
<%=username%>
<input type="hidden" name="username" value="<%=username%>">
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">密碼</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="password" value=<%=rs.getString("Password")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">Email</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="email" value=<%=rs.getString("Email")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">性別</td>
<td bgcolor="#efefef" width="63%">
<%
if(rs.getString("Sex").equals("men")) {%>
<input type="radio" name="sex" value="men" checked><img src="images/boy.gif" width="24" height="24">男孩
<input type="radio" name="sex" value="women"><img src="images/girl.gif" width="26" height="26">女孩
<%}else{%>
<input type="radio" name="sex" value="men"><img src="images/boy.gif" width="24" height="24">男孩
<input type="radio" name="sex" value="women" checked><img src="images/girl.gif" width="26" height="26">女孩
<%}%>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">電話</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="phone" value=<%=rs.getString("Phone")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">地址</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="address" value=<%=rs.getString("Address")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">年齡</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="age" value=<%=rs.getString("Age")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">頭像</td>
<td bgcolor="#efefef" width="63%">
<select name="face" size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
<%
for (int i=1;i<=60;i++)
out.println("<option value=images/face/Image" + i + ".gif>Image"+ i +"</option>");
%>
</select>
<img id=face src=<%=rs.getString("Face")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">發貼數</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="postnumber" value=<%=rs.getInt("PostNumber")%>>
</td>
</tr>
<tr>
<td bgcolor="#efefef" width="37%">等級</td>
<td bgcolor="#efefef" width="63%">
<input type="text" name="rank" value=<%=rs.getInt("Rank")%>>
</td>
</tr>
<tr>
<td colspan=2>
<center>
<input type="submit" value="確定">      
<input type="reset" value="重置">
</center>
</td>
</tr>
</table>
<% stmt.close();
conn.close();
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -