?? register.jsp
字號:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="c" prefix="c" %>
<%@ taglib uri="shop" prefix="shop"%>
<%
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 'register.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">
-->
</head>
<script language="Javascript">
function init() {
document.forms[0].loginName.focus();
}
function IsEmpty(aTextField) {
if ((aTextField.length==0) || (aTextField==null))
{
return true;
}
}
function login(){
if(document.forms[0].loginName.value=="" || document.forms[0].loginName.value==null){
alert('用戶名不能為空');
document.forms[0].loginName.focus();
return false;
}
var RegName = /^[a-zA-Z]{1}[\w]{1,20}$/;
if(!RegName.exec(document.forms[0].loginName.value) || document.forms[0].loginName.value.length < 5){
alert('用戶名首字符必須是字母,其后只能含有字母、數字和下劃線,且長度在5到20位內!');
document.forms[0].loginName.focus();
return false;
}
if(document.forms[0].loginName.value.length < 5 || document.forms[0].loginName.value.length > 20)
{
alert("用戶名至少在5位以上,且在20位以內!");
return false;
}
if(document.forms[0].userPwd.value=="" || document.forms[0].userPwd.value==null){
alert("密碼不能為空");
document.forms[0].userPwd.focus();
return false;
}
var myReg = /^[a-zA-Z0-9^`~!@#$%&*()?;:\\\/>.<,\^^\-_\=\+|\}\]\[\{\、!·#¥%……—‘’“”;:?。》《, ]{1,20}$/;
if(!myReg.exec(document.forms[0].userPwd.value) || document.forms[0].userPwd.value.length < 6){
alert('密碼最小長度為 6 位!最大長度20位!同時密碼中不能有逗號出現!');
document.forms[0].userPwd.focus();
return false;
}
if(document.forms[0].newPwdConfirm.value != document.forms[0].userPwd.value)
{
alert("密碼和確認碼不一致,請重新輸入!");
document.forms[0].newPwdConfirm.focus();
return false;
}
if(document.forms[0].userAddress.value=="" || document.forms[0].userAddress.value==null)
{
alert("用戶詳細地址不能為空");
document.forms[0].userAddress.focus();
return false;
}
if(document.forms[0].userZip.value=="")
{
alert("用戶郵政編碼不能為空");
document.forms[0].userZip.focus();
return false;
}
document.forms[0].strutsAction.value="4";
return true;
}
function test_RegisterName(strInput){
var myReg = /^[a-zA-Z]{1}[\w]{1,19}$/;
if(!myReg.exec(strInput))
{
return false;
}
else
{
return true;
}
}
function test_Password(strInput){
var myReg = /^[a-zA-Z0-9^`~!@#$%&*()?;:"\\'\/>.<,\^^\-_\=\+|\}\]\[\{\、!·#¥%……—‘’“”;:?。》《, ]{6,20}$/;
if(!myReg.exec(strInput))
{
return false;
}
else
{
return true;
}
}
function test_Email(strEmail){
var myReg = /^([\S])+[@]{1}([\S])+[.]{1}(\S)+$/;
if(myReg.exec(strEmail))
{
return true;
}
else
{
return false;
}
}
function test_Qustion(strInput){
var myReg = /^.{2,100}$/;
if(myReg.exec(strInput))
{
return true;
}
else
{
return false;
}
}
function test_Answer(strInput){
var myReg = /^.{2,100}$/
if(myReg.exec(strInput))
{
return true;
}
else
{
return false;
}
}
//-->
</SCRIPT>
<body>
<html:form method="POST" action="/user/register.do">
<table width="800" align="center">
<tr>
<td>
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">
用戶名:
</td>
<td width="25%">
<html:text property="loginName" />
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">密碼:
</td>
<td width="25%">
<html:password property="userPwd" />
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">確認碼:
</td>
<td width="25%">
<html:password property="newPwdConfirm"/>
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">
</td>
<td width="25%">
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">
真實姓名:
</td>
<td width="25%">
<html:text property="userName" />
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">性別:
</td>
<td width="25%">
<html:radio property="userSex" value="1"/>男 <br>
<html:radio property="userSex" value="0"/>女
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">電子郵件:
</td>
<td width="25%">
<html:text property="userEmail"/>
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">手機號:
</td>
<td width="25%">
<html:text property="userPhone" />
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">詳細地址:
</td>
<td width="50%">
<html:textarea property="userAddress"/>
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">郵證編碼:
</td>
<td width="25%">
<html:text property="userZip"/>
</td>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
</td>
<td width="25%">
<input type="submit" name="adduser" value="提交" onClick="return login();">
</td>
<td width="25%">
</td>
<td width="25%">
<html:hidden property="strutsAction" />
</td>
</tr>
</table>
</html:form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -