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

📄 reg.jsp

📁 自己编写的jsp+mysql论坛系统,带后台系统.不是很完善,但是功能是完整的
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK"
	pageEncoding="GBK"%>
<%@page import="java.util.*,java.io.*,java.sql.*"%>
<%@ include file="conn.jsp"%>
<!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=GBK">
		<title>用户注册</title>
	</head>
	<body>
		<!-- 载入页头 -->
		<jsp:include page="./include/top.jsp"></jsp:include>
		<%
			int tmp = 0;
			String vcode = "";
			//生成验证码 1001-9999
			do {
				tmp = (int) (Math.random() * 10000 - 1);
			} while (tmp <= 1000);
			vcode = String.valueOf(tmp);
		%>
		<script type="text/javascript">
	function check(){
		if(form.username.value==""){
			alert("用户名不能为空!");
			return false;
		}
		if(form.password.value==""){
			alert("密码不能为空!");
			return false;
		}
		if(form.con_password.value==""){
			alert("验证密码不能为空!");
			return false;
		}
		if(form.email.value==""){
			alert("邮箱地址不能为空!");
			return false;
		}else{
			var i=0;
			var strtmp="";
			var flag=false;
			for(i=0;i<form.email.value.length;i++){
				strtmp=form.email.value.substring(i,i+1);
				if(strtmp=="@"){
					flag=true;
					break;
				}else{
					flag=false;
				}
			}
			if(flag==false){
				alert("邮箱地址格式不合法!");
				return false;
			}
		}
		if(form.vcode.value==""){
			alert("验证码不能为空!");
			return false;
		}
		if((form.username.value.length<6)||(form.username.value.length>10)){
			alert("用户名长度在6到10个字符之间!");
			return false;
		}
		if((form.password.value.length<6)||(form.password.value.length>10)){
			alert("密码长度在6到10个字符之间!");
			return false;
		}
		if((form.con_password.value.length<6)||(form.con_password.value.length>10)){
			alert("验证密码长度在6到10个字符之间!");
			return false;
		}
		if(form.password.value!=form.con_password.value){
			alert("两次输入的密码不一致!");
			return false;
		}
		if(form.vcode.value!=<%=vcode%>){
			alert("验证码不正确!");
			return false;
		}
	}
	</script>
		<div align="center">
			用户注册
			<br>
		</div>
		<form method="post" action="reg_Action.jsp" name="form"
			onsubmit="return check()">
			<p>
				用户名: &nbsp;
				<input type="text" maxlength="10" size="10" name="username">
				必须以字母或下划线开头的包含字母数字下划线的字符串
			</p>
			<p>
				密&nbsp; 码: &nbsp;
				<input type="password" maxlength="10" size="10" name="password">
			</p>
			<p>
				验证密码:
				<input type="password" maxlength="10" size="10" name="con_password">
			</p>
			<p>
				电子邮箱:
				<input type="text" maxlength="40" size="40" name="email">
			</p>
			<p>
				验证码: &nbsp;
				<input type="text" maxlength="4" size="4" name="vcode">
				<font color="red"><%=vcode%></font>
			</p>
			<p>
				<input type="submit" value="注册" name="submit">
				<input type="reset" value="重置" name="reset">
			</p>
		</form>
		<!-- 载入页尾 -->
		<jsp:include page="./include/foot.jsp"></jsp:include>
	</body>
</html>

⌨️ 快捷键说明

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