admin_profile.jsp

来自「自己编写的jsp+mysql论坛系统,带后台系统.不是很完善,但是功能是完整的」· JSP 代码 · 共 101 行

JSP
101
字号
<%@ page language="java" contentType="text/html; charset=GBK"
	pageEncoding="GBK"%>
<!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="admin_include.jsp"></jsp:include>
		<%
			String username = "";
			if (null != session.getAttribute("adminlogin")) {
				username = session.getAttribute("adminlogin").toString();
		%>
		<%
			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.old_password.value==""){
		alert("原密码不能为空!");
		form.old_password.focus();
		return false;
	}
	if((form.old_password.value.length<6)||(form.old_password.value.length>10)){
		alert("密码长度在6到10个字符之间!");
		form.old_password.focus();
		return false;
	}
	if((form.password.value.length<6)||(form.password.value.length>10)){
		alert("密码长度在6到10个字符之间!");
		form.password.focus();
		return false;
	}
	if((form.con_password.value.length<6)||(form.con_password.value.length>10)){
		alert("密码长度在6到10个字符之间!");
		form.con_password.focus();
		return false;
	}
	if(form.vcode.value!=<%=vcode%>){
		alert("验证码不正确!");
		form.vcode.focus();
		return false;
	}
	}
	</script>
		<div align="center">
			修改个人资料
			<br>
			<div align="left">
				<form method="post" action="admin_profile_Action.jsp" name="form"
					onsubmit="return check()">
					<p>
						用户名: &nbsp;&nbsp;
						<font color="blue"><%=username%></font>
					</p>
					<p>
						原密码:&nbsp;&nbsp;
						<input type="password" maxlength="10" size="10"
							name="old_password">
					</p>
					<p>
						新密码: &nbsp;
						<input type="password" maxlength="10" size="10" name="password">
					</p>
					<p>
						验证密码:
						<input type="password" maxlength="10" size="10"
							name="con_password">
						更改密码后需要重新登录
					</p>
					<p>
						验证码:&nbsp;&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>
			</div>
		</div>
		<%
			} else {
				response.sendRedirect("../error.jsp");
			}
		%>

		<!-- 载入页尾 -->
		<jsp:include page="../include/foot.jsp"></jsp:include>
	</body>
</html>

⌨️ 快捷键说明

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