📄 reg.jsp~5~
字号:
<%@ 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>
<table width="550" border="0" align="center" cellpadding="0"
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 + -