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

📄 regist.jsp

📁 Java购物车及JSTL的应用
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GB18030"
	pageEncoding="GB18030"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title>美讯集团产品发布平台</title>
		<LINK id=MainCss href="/Store/css/style.css" type="text/css"
			rel=stylesheet>

		<SCRIPT language=javascript src="/BookShop/css/Ajax_IndexLoad.js"
			type=text/javascript charset=gb2312> </SCRIPT>
		<script language="javascript">
			function isMadeOf(val,str){
				var jj;
				var chr;
				for (jj=0;jj<val.length;++jj){
					chr=val.charAt(jj);
					if (str.indexOf(chr,0)==-1)
						return false;
					}
					return true;
				}
	
			function forPhone(obj){
				var phoneStr= "()-#0123456789";
				if (!isMadeOf(obj.value,phoneStr)){
					flag = 1;
					return false;
				}
				return true;
			}
	
	function forPostalcode(obj){
		var postalcode= "0123456789";
		if (!isMadeOf(obj.value,postalcode)){
			flag = 1;
			return false;
		}
		return true;
	}
	
	function verifyUsername(strUsername){
		var myReg = /^[_a-zA-Z0-9_-_@_._.]+\w$/;
		if(myReg.test(strUsername))
			return true;
		else
			return false;
	}
	function isEmail(s){
		if (s.length > 100)
			return false;
		var regu="^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[_.0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$";  
		var re = new RegExp(regu);
		if (s.search(re) != -1)
			return true;
		else 
			return false;
	}

	function check(){
		if(document.logform.uname.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("会员帐号不能为空!");
			document.logform.uname.focus();
			return false;
		}
		if(document.logform.uTname.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("用户姓名不能为空!");
			document.logform.uTname.focus();
			return false;
		}
		if(document.logform.upsd.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("登录密码不能为空!");
			document.logform.upsd.focus();
			return false;
		}
		if(!verifyUsername(document.logform.upsd.value)){
			alert("登录密码不正确!应为英文或数字组成!");
			document.logform.upsd.focus();
			return false;
		}
		if(document.logform.upsd.value!=document.logform.rupsd.value){
			alert("密码和确认密码填写的内容不一样,请从新填写!");
			document.logform.upsd.focus();
			return false;
		}
		if(document.logform.uemail.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("Email不能为空!");
			document.logform.uemail.focus();
			return false;
		}
		if(document.logform.uemail.value.replace(/(^\s*)|(\s*$)/g, "")!=""){
			if(!isEmail(document.logform.uemail.value)){
				alert("Email输入有误,请检查!");
				document.logform.uemail.focus();
				return false;
			}
		}
		if(document.logform.uphone.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("电话不能为空!");
			document.logform.uphone.focus();
			return false;
		}
		if(document.logform.uphone.value.replace(/(^\s*)|(\s*$)/g, "")!=""){
			if(!forPhone(document.logform.uphone)){
				alert("电话值不正确!请填写数字,可以包含(,),-,#符号");
				document.logform.uphone.focus();
				return false;
			}
		}
		if(document.logform.uzip.value.replace(/(^\s*)|(\s*$)/g, "")==""){
			alert("邮编不能为空!");
			document.logform.uzip.focus();
			return false;
		}
		if(document.logform.uzip.value.replace(/(^\s*)|(\s*$)/g, "")!=""){
			if(!forPostalcode(document.logform.uzip)){
				alert("所填邮编不正确!请填写数字");
				document.logform.uzip.focus();
				return false;
			}
		}
		document.logform.submit();
	}
</script>
	</head>

	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<%
		session.setAttribute("url", request.getRequestURI());
		%>
		<%@ include file="./Head.jsp"%>
		<table width="742" border="0" align="center" cellpadding="0"
			cellspacing="0" bgcolor="#669999">
			<tr bgcolor="#669999">
				<td height="20" colspan="3">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td width="170" height="20" valign="top" bgcolor="#669999">
					<%@ include file="./Login.jsp"%>
				</td>
				<td width="8">
					&nbsp;
				</td>

				<td width="559" valign="top" bgcolor="#669999">
					<form name="logform" action="../UserServlet" method="post">
						<table width="100%" border="0">
							<tr>
								<td bgcolor="#669999" class="w-3" valign="bottom">
									<strong>新用户注册:</strong>
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									您的会员帐号:
								</td>
								<td width="83%">
									<label>
										<input name="uname" type="text" id="uname" size="15"
											maxlength="20" value="${uuser.uname}">
									</label>
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									<label>
										【这是您登录的名字】
									</label>
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									您的姓名:
								</td>
								<td width="83%">
									<input name="uTname" type="text" id="uTname" size="15"
										maxlength="30" value="${uuser.utname }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【请您留下您的真是姓名,便于我们与您联系及发货】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									密码:
								</td>
								<td width="83%">
									<input name="upsd" type="password" id="upsd" size="15"
										maxlength="20" value="${uuser.upassword }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【长度太小的密码很不安全,而长度太大的密码又不方便记忆,所以请您将密码的长度限制在4-16个字符之间。密码的组成元素只能是英文字母、数字。例如:sms2000等】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									密码确认:
								</td>
								<td width="83%">
									<input name="rupsd" type="password" id="rupsd" size="15"
										maxlength="20" value="${uuser.upassword }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【请您在“密码确认”方框中输入与“密码”相同的信息,这是为了防止设置密码时输入错误。】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									E-MAIL:
								</td>
								<td width="83%">
									<input name="uemail" type="text" id="uemail" size="25"
										maxlength="30" value="${uuser.uemaile }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【请您填上正确的电子邮件地址,这样我们才方便与您联系。如果您有两个以上邮箱,请只填写您最常用的一个邮箱地址。】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									常用电话:
								</td>
								<td width="83%">
									<input name="uphone" type="text" id="uphone" size="15"
										maxlength="15" value="${uuser.uphone }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【请填写能随时联系到您的电话,以便您在购物后我们能随时与您取得联系。】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									收货地址:
								</td>
								<td width="83%">
									<input name="uaddress" type="text" id="uaddress" size="50"
										maxlength="50" value="${uuser.uaddress }">
								</td>
							</tr>
							<tr>
								<td width="17%">
									&nbsp;
								</td>
								<td width="83%">
									【请填写您能最直接收到货物的地址,以便我们能尽快将您所购买的商品邮递给您】
								</td>
							</tr>
						</table>
						<hr>
						<table width="100%" border="0" class="w-1">
							<tr>
								<td width="17%">
									邮编:
								</td>
								<td width="83%">
									<input name="uzip" type="text" id="uzip" size="15"
										maxlength="6" value="${uuser.uzip }">
								</td>
							</tr>
						</table>
						<hr>
						<br>
						<table width="200" border="0" align="right">
							<tr>
								<td width="144">
									<div align="right" class="w-1">
										<input type="hidden" name="action" value="regist">
										<a style='cursor:hand' onClick="check()">
										 <c:choose>
												<c:when test="${upinfo!=null&&upinfo=='yes'}">
													<input type="hidden" name="up" value="update">
													修改
												</c:when>
												<c:otherwise>
													<img src="../pic/log.jpg" border="0">
												</c:otherwise>
											</c:choose>
											 </a>
									</div>
								</td>
								<td width="46" class="w-1">
									<c:if test="${isyes!=null&&isyes=='no'}">
										 操作失败!
									</c:if>
								</td>
							</tr>
						</table>
					</form>
					<br>
					<br>
					<br>
					<br>
					<br>
					<br>
					<br>
				</td>
			</tr>
		</table>
		
		<%--标示操作是否成功--%>
		<c:remove var="isyes" scope="session"/>
		<%@ include file="./Tail.jsp"%>
	</body>
</html>

⌨️ 快捷键说明

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