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

📄 register.jsp

📁 spring struts hibernate 集成开发的web应用
💻 JSP
字号:
<%@ page language="java" pageEncoding="UTF-8"%>
<%@page contentType="text/html; charset=gb2312"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<html:base />

		<title>[用户注册]</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 href="../../css/css.css" rel="stylesheet" type="text/css">
		<SCRIPT language="javascript">
 
function userNameQuery(userNameInfo){
	//validate	
	username = document.registerForm.username;
	if(username.value ==""||username.value.length<4||username.value.length>20){
		alert("请正确输入昵称(最少两个字符,最多20个字符)");
		username.focus();
		username.select();
		return false;
	}
	//display
	document.getElementById("userNameHint").innerHTML="用户名检测中,请稍等...";
	//request
	var url = "<%=request.getContextPath()%>/checkUsername.do?username="+username.value;
	initRequest();	
    if(req){
        				    	
    	req.onreadystatechange = processRequest;
    	req.open("GET", url, false);
    	req.send(null);
    }
}

function initRequest(){
	if (window.XMLHttpRequest) {
		
        req = new XMLHttpRequest();
        if (req.overrideMimeType) {
            req.overrideMimeType('text/xml');
        }
        alert("2");
    }else if (window.ActiveXObject) {
    	
        req = new ActiveXObject("Microsoft.XMLHTTP");
		  		
    }
}

function processRequest(){
	
    if (req.readyState == 4) {
        if (req.status == 200) {		  
		  
  			var message  = req.responseXML.documentElement;         						
          						
      	  	returnMsg    = message.getElementsByTagName("message")[0].firstChild.data;
      	  			
      	  	var userNameMsg;
      	  	var FLAG ="success";
      	  	if (returnMsg == "yes"){
      	  		userNameMsg = "<font color=green><b>恭喜</b>!这个昵称可用</font>";
      	  		FLAG = "congtatulation";
      	  	}
      	  	else if (returnMsg == "no"){
      	  		userNameMsg = "<font color=red><b>抱歉</b>!这个昵称已被人使用</font>";      	  							
      	  		FLAG = 	"sorry";
      	  	}
      	  	else if(returnMsg =="nodata"){
      	  		userNameMsg =  "<font color=red><b>抱歉</b>!你没有输入昵称</font>";
     	  		FLAG = 	"sorry";
      	  	}		
      	  							     	  							
      	    displayMsg(userNameMsg,FLAG);
      	    						      	           
        } else {
          	alert ( "Not able to retrieve description" + req.statusText);
          			
		}
    }  
}

function displayMsg(userNameMsg,FLAG){
	
	document.getElementById("userNameHint").innerHTML = userNameMsg;
	//如果用户输入的昵称已被人使用、没有输入昵称
	if ("sorry"==FLAG){
		document.registerForm.elements(0).focus();
		document.registerForm.elements(0).select();
	}
}
</SCRIPT>
		<script language='javascript'>

<!--

function infoHint(tdx){

	document.getElementById(tdx).style.border='1px #22ADCE solid';
	document.getElementById(tdx).style.color='#006982';
	//document.all[tdx].style.paddingRight='5px';
	document.getElementById(tdx).style.backgroundColor='#EEFAFD';
}
function exitHint(tx){
	//var userNameInfoTd = document.getElementById("userNameHint");
	document.getElementById(tx).style.border='0px #666666';
	//document.all[tdx].style.color='#848484';
	//document.all[tdx].style.paddingLeft='8px';
	//document.all[tdx].style.paddingRight='5px';
	document.getElementById(tx).style.backgroundColor='#ffffff';
	//userNameInfoTd.innerHTML="用户名检测中,请稍等...";
}



function checkRegisterForm(){
var form = document.registerForm;

	if(form.username.value==""){
		window.alert("您还没有填写昵称");
		form.username.focus();
		return false;
	}
	if(form.username.value.length<4||form.username.value.length>20){
		window.alert("请正确填写您的昵称");
		form.username.focus();
		return false;
	}
	
	if(form.password.value==""){
		window.alert("您还没有填写您的密码");
		form.password.focus();
		return false;
	}
	if(form.password.value.length<6||form.password.value.length>20){
		window.alert("您的密码格式有误,请正确填写密码");
		form.password.focus();
		return false;
	}
	if(form.verifyPassword.value==""){
		window.alert("您的密码为空");
		form.verifyPassword.focus();
		return false;
	}
	if(form.verifyPassword.value!=form.password.value){
		window.alert("您两次填写的密码不一致");
		form.password.focus();
		return false;
	}
	
	if(form.safeemail.value==""){
		window.alert("您还没有输入邮件");
		form.safeemail.focus();
		return false;
	}
	if(form.safeemail.value.indexOf("@") == -1||form.safeemail.value.indexOf(".") == -1){
		window.alert("您的邮件格式有误,请正确输入邮件地址");
		form.safeemail.focus();
		return false;
	}
	if(form.affirmanswer.value==""){
		window.alert("请输入您的答案");
		form.affirmanswer.focus();
		return false;
	}
	
}

//-->
</script>
	</head>


	<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
		<!--DWLayoutTable-->

		<tr>
			<td height="27" valign="top">
				<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-bottom-style:solid;border-bottom-color:999999;border-bottom-width:2px">
					<!--DWLayoutTable-->
					<tr>
						<td width="950" height="25" valign="middle">
							2&nbsp;&nbsp;填写注册信息(带*的为必填项) [用户注册]
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="546" valign="top">
				<html:form method="post" action="register.do">
					<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
						<!--DWLayoutTable-->
						<tr>
							<td width="760" height="18" valign="top">
								<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-bottom-style:dashed;border-bottom-color:999999;border-bottom-width:1px">
									<!--DWLayoutTable-->
									<tr>
										<td width="900" height="18">
											<div align="left">
												[用户昵称和密码]&nbsp;&nbsp;&nbsp;&nbsp;
											</div>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="174" valign="top">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<!--DWLayoutTable-->
									<tr>
										<td height="72" valign="top">
											<table width="100%" height="50" border="0" cellpadding="5">
												<!--DWLayoutTable-->
												<tr>
													<td width="28%" height="74">
														<div align="right">
															<strong>用户昵称</strong>*:
														</div>
													</td>
													<td width="22%">
														<html:text property="username" onfocus="infoHint('userNameHint')" onblur="userNameQuery('userNameHint')" />
													</td>
													<td width="50%" id="userNameHint">
														<font color="#666666">4-20 个字符 (包括大小写字母,数字等) 建议使用英文。注册后不可修改。</font>
													</td>
												</tr>
												<!--
                      <tr> 
                        <td width="28%" height="34"> <div align="right"><strong>用户类型</strong>*:</div></td>
                        <td width="22%"><select name="UserType" disabled>
                            <option  selected value="0">普通用户</option>
                          </select><input type="hidden" name="usertype" value="0"></td>
                        <td width="50%" id="userNameHint"><font color="#666666">默认为普通用户,请认真填写下面的信息。</font></td>
                      </tr>-->
											</table>
										</td>
									</tr>
									<tr>
										<td height="102">
											<table width="100%" border="0" cellpadding="5">
												<tr>
													<td width="28%" height="39">
														<div align="right">
															<strong>密码</strong>*:
														</div>
													</td>
													<td width="22%">
														<html:password property="password" onfocus="infoHint('userPasswordHint')" onblur="exitHint('userPasswordHint')" />
													</td>
													<td width="50%" id="userPasswordHint">
														<font color="#666666">密码由6-20个英文字母(区分大小写)或数字组成,建议采用英文数字组合<strong>。</strong></font>
													</td>
												</tr>
												<tr>
													<td height="39">
														<div align="right">
															<strong>再次输入密码</strong>*:
														</div>
													</td>
													<td>
														<html:password property="verifyPassword" onblur="exitHint('verifyPasswordHint')" onfocus="infoHint('verifyPasswordHint')" />
													</td>
													<td>
														<font color="#666666" id="verifyPasswordHint">重复输入一次上面的密码。</font>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="18" valign="top">
								<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-bottom-style:dashed;border-bottom-color:999999;border-bottom-width:1px">
									<!--DWLayoutTable-->
									<tr>
										<td width="900" height="18">
											<div align="left">
												[其他基本信息]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											</div>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="159" valign="top">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<!--DWLayoutTable-->
									<tr>
										<td height="139" valign="top">
											<table width="100%" border="0" cellpadding="5">
												<!--DWLayoutTable-->
												<tr>
													<td width="28%" height="29">
														<div align="right">
															您的电子邮件<strong>*</strong>:
														</div>
													</td>
													<td width="22%">
														<input type="text" name="safeemail" onfocus="infoHint('emailHint')" onblur="exitHint('emailHint')" />
													</td>
													<td width="50%" id="emailHint">
														非常重要!是与您联系的首选方式,如果没有,推荐免费<a href="http://reg.126.com/reg1.jsp?from=" target="_blank">网易邮箱</a>
													</td>
												</tr>
												<tr>
													<td height="31">
														<div align="right">
															提示问题:
														</div>
													</td>
													<td>
														<html:select property="affirmquestion">
															<html:option value="0">您的家乡</html:option>
															<html:option value="1">您的一位恩师</html:option>
															<html:option value="2">您最尊重的人</html:option>
															<html:option value="3">您最爱吃的菜</html:option>
														</html:select>
													</td>
													<td>
														用于找回密码。
													</td>
												</tr>
												<tr>
													<td height="27">
														<div align="right">
															问题答案:
														</div>
													</td>
													<td>
														<html:text property="affirmanswer" onfocus="infoHint('answer')" />
													</td>
													<td id="answer">
														请输入并记住密码提示答案。
													</td>
												</tr>
												<tr>
													<td>
														<div align="right">
															输入验证码<strong>*</strong>:
														</div>
													</td>
													<td>
														<html:text property="verify_code" />
													</td>
													<td>

													</td>
												</tr>
												<tr>
													<td height="9"></td>
													<td></td>
													<td></td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="16">&nbsp;
								
							</td>
						</tr>
						<tr>
							<td height="38">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<!--DWLayoutTable-->
									<tr>
										<td height="29">
											<table width="100%" border="0" style="border-bottom-style:dashed;border-bottom-color:999999;border-bottom-width:1px">
												<tr>
													<td>
														[提交表单]
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td width="900" height="34">
											<div align="center">
												<html:submit property="Submit" value="同意服务条款,提交注册信息" onclick="return checkRegisterForm();" />
											</div>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</html:form>
			</td>
		</tr>
		<tr>
			<td height="16" valign="top">
				<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-top-style:solid;border-top-color:999999;border-top-width:2px">
					<!--DWLayoutTable-->
					<tr>
						<td width="950" height="16">&nbsp;
							
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="58">&nbsp;
				
			</td>
		</tr>
	</table>
	<div align="center"></div>
</html>

⌨️ 快捷键说明

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