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

📄 modify.jsp

📁 JSP+ORCLE 实现后台登陆
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="xwfb.connectDB" />
<html>
<head>
<title>修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
			function add()
			{
				if(add_form.username.value.length == 0 || add_form.psw.value.length == 0 || add_form.psw1.value.length == 0)
				{
					alert("不能为空");
				}
				else
				{
					if(add_form.psw.value != add_form.psw1.value)
					{
						alert("密码不一致");
					}
					else
					{
						add_form.submit();
					}
				}
			}
		</script>
</head>
<%
	String psw = request.getParameter("psw");
	if(psw == null)
	{
		%>
		<form action="modify.jsp" method="post" name="add_form">
		<table>
		<tr>
		<td width="100" class="text-login">用户:</td>
		<td width="120" class="text-login"><input type="text" name="username" value="<%=(String)session.getAttribute("username")%>" class="inputlength120" maxlength="20" disabled></td>
		</tr>
		<tr>
		<td width="100" class="text-login">密码:(不小于7位,不超过50位)</td>
		<td width="120" class="text-login"><input type="password" name="psw" class="inputlength120" maxlength="20"></td>
		</tr>
		<tr>
		<td width="100" class="text-login">确认密码:</td>
		<td width="120" class="text-login"><input type="password" name="psw1" class="inputlength120" maxlength="20"></td>
		</tr>
		<tr>
		<td width="100" valign="middle"><input type="button" value="提交" onclick="add()" class="logbutton"></td>
		<td width="120" valign="middle"><input type="reset" value="重填" class="logbutton"></td>
		</tr>
		</table>
		</form>
		<%
	}
	else
	{
		try
		{
			String sql = "update XWFB_USER set password = '"+psw+"' where username = '"+(String)session.getAttribute("username")+"'";
			out.print(sql);
			db.executeUpdate(sql);
			session.removeAttribute("username");
			session.removeAttribute("priority");
			%>
			<script language="javascript">
				alert("修改成功");
				window.close();
				opener.top.location.reload();
			</script>
			<%
		}
		catch(Exception e)
		{
			session.setAttribute("error","1");
			response.sendRedirect("error.jsp");
		}
		finally
		{
			try
			{
				db.closeDB();
			}
			catch(Exception ee)
			{
				session.setAttribute("error","1");
				response.sendRedirect("error.jsp");
			}
		}
	}
%>
</html>

⌨️ 快捷键说明

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