?? reg.jsp~4~
字號:
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page session="true" %>
<jsp:useBean id="user" scope="page" class="check.usermn" />
<%try{
String mesg = "";
String submit = request.getParameter("Submit");
if (submit!=null && !submit.equals("")) {
if(user.insert(request)){
session.setAttribute("username",user.getUserName());
session.setAttribute( "userid", Long.toString( user.getUserid() ) );
response.sendRedirect("userinfo.jsp?action=regok");
} else if (!user.getMessage().equals("")) {
mesg = user.getMessage();
} else
mesg = "注冊時出現錯誤,請稍后再試";
}
%>
<html>
<head>
<title>>使用seesion對象進行身份驗證</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script type="" language="javascript" src="check.js"></script>
<script type="" language="javascript" >
function openScript(url,name, width, height){
var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function checkform() {
if (document.form1.username.value==""){
alert("用戶名不能為空");
document.form1.username.focus();
return false;
}
if (document.form1.passwd.value==""){
alert("用戶密碼不能為空");
document.form1.passwd.focus();
return false;
}
if (document.form1.passwd.value!=document.form1.passconfirm.value){
alert("確認密碼不相符!");
document.form1.passconfirm.focus();
return false;
}
return true;
}
</script>
<link rel="stylesheet" href="books.css" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {
color: #FF3300;
font-size: 16px;
}
body {
background-color: #FFFFFF;
background-image: url(image/bg06.jpg);
}
.style3 {color: #336600}
.style4 {
color: #6633CC;
font-weight: bold;
}
-->
</style>
</head>
<body text="#000000">
<div align="center">
<p class="style2"> </p>
<form name="form1" method="post" action="">
<%if (!mesg.equals("")) out.println("<p><font color=#ff0000>"+ mesg + "</font></p>");%>
cellspacing="0"> <tr>
<td bgcolor="#000000" width="551">
<table width="551" border="0" cellspacing="1"
cellpadding="3" >
<tr bgcolor="#99cc00">
<td width="543"
height="13" colspan="2">
<div align="center"><font color="#ffffff" size="2">會員注冊
</font>
</div></td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">用戶名:</span></td>
<td width="272">
<input type="text" name="username" maxlength="20" size="14" >
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">密碼:</span></td>
<td width="272">
<input type="password" name="passwd" maxlength="20" size="14">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">確認密碼:</span></td>
<td width="272">
<input type="password" name="passconfirm" maxlength="20" size="14">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">真實姓名:</span></td>
<td width="272">
<input type="text" name="names" maxlength="20" size="14">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">性別:</span></td>
<td width="272">
<select name="sex">
<option>男</option>
<option>女</option>
</select>
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">聯系地址:</span></td>
<td width="272">
<input type="text" name="address" maxlength="150" size="40">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">聯系郵編:</span></td>
<td width="272">
<input type="text" name="post" maxlength="8" size="8">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">聯系電話:</span></td>
<td width="272">
<input type="text" name="phone" maxlength="25" size="16">
</td>
</tr>
<tr>
<td width="171" align="right"><span class="style3">電子郵件:</span></td>
<td width="272">
<input type="text" name="email" maxlength="50" size="25">
</td>
</tr>
<tr>
<td width="171" align="right"> </td>
<td width="272">
<input type="submit" name="Submit" value="注冊" onclick="javascript:return(checkform());">
<input type="reset" name="reset" value="取消">
</td>
</tr>
</table>
</form>
<p> </p>
</div>
</body>
</html>
<% user.close();//關閉數據庫連接
}catch(Exception e){e.printStackTrace();}%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -