<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="name.jsp" %>
<jsp:useBean id="DBConnection" scope="page" class="com.raecom.DBConnection"/>
<%
String Useradmin = (String)session.getValue("admin");
Boolean a=(Boolean)session.getAttribute("a");
Connection conn=DBConnection.getConnectionToAccess(application.getRealPath("data/RAE-Systems.mdb"));
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
if(a==null||a.booleanValue()==false)
{
%>
<script language=JavaScript>
alert('此页面仅对登录用户开放!');
location.href="index.jsp"
</script>
<%
}else{
String admin=request.getParameter("admin");
if (admin==null)
{
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改管理信息</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function check(){
if(post.admin.value==""){
alert("请输入您的用户名");
return false;
}
if(post.admin.value.length>30){
alert("用户名位数不超过15");
return false;
}
if(post.password.value==""){
alert("请输入密码");
return false;
}
if(post.password.value.length>50){
alert("密码位数不超过24");
return false;
}
if(post.password2.value==""){
alert("请输入重复密码");
return false;
}
if(post.password2.value.length>50){
alert("重复密码位数不超过24");
return false;
}
if(post.password.value!=post.password2.value){
alert("输入的两次密码不一致");
return false;
}
return true;
}
</script>
<SCRIPT src="images/index.js"></SCRIPT>
</head>
<body>
<jsp:include page="top.htm" />
<table cellspacing=0 cellpadding=0 width=760 align=center border=0 bgcolor="#FFFFFF">
<tr>
<td width="200" valign=top>
<jsp:include page="left.jsp" />
</td>
<td valign=top class="tdbg_leftall">
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td valign=top>
<table cellspacing=0 cellpadding=0 width="100%" align=center border=0>
<tr>
<td></td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center" style=":break-all;font-family: Arial, Helvetica, sans-serif;">
<tr>
<td width="560">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="28"><table border="1" width="100%" cellspacing="0" cellpadding="0" align="center" bgcolor="#4791C5" >
<tr>
<td width="100%" height="24">
<p align="center">
<font color="#FFFFFF">...::修改管理信息::...</font></td>
</tr>
</table>
<%
String sql="select * from employee where Use_Name='"+Useradmin+"'";
ResultSet Rs=stmt.executeQuery(sql);
while(Rs.next())
{
%>
<form action="config.jsp?" method="post" name="post" id="post" onsubmit="return check();">
<table border="0" width="260" id="table1" align="center">
<tr>
<td>
<p align="right">用户帐号:</td>
<td> <INPUT
name="admin" id="admin" value=<%=Rs.getString("Use_Name")%> size=18></td>
</tr>
<tr>
<td>
<p align="right">用户密码:</td>
<td><span class="f12">
</span><INPUT type=password size=19
value=<%=Rs.getString("Password")%> name="password"></td>
</tr>
<tr>
<td>
<p align="right">重 复 密码:</td>
<td>
<INPUT type=password size=19
value=<%=Rs.getString("Password")%> name="password2"></td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<INPUT type=submit value="确认修改" name=Submit> <INPUT type=reset value="清 除" name=Submit2>
</td>
</tr>
</table>
</form>
<% } %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
}
else
{
String password=request.getParameter("password");
String sql1="update employee set Use_Name='"+admin+"',Password='"+password+"' where Use_Name='"+Useradmin+"'";
try{
stmt.executeUpdate(sql1);
session.invalidate();
%>
<script language=JavaScript>
alert('修改成功,请使用新身份重新登陆系统进行管理!');
location.href="login.jsp"
</script>
<%
}catch(Exception e)
{
response.sendRedirect("error.jsp?error=2");//数据库更新出错!
}
}
if(conn!=null)
{
conn.close();
}
if(stmt!=null)
{
stmt.close();
}
}
%>
<%@ include file="name.jsp" %>
<jsp:useBean id="DBConnection" scope="page" class="com.raecom.DBConnection"/>
<%
String Useradmin = (String)session.getValue("admin");
Boolean a=(Boolean)session.getAttribute("a");
Connection conn=DBConnection.getConnectionToAccess(application.getRealPath("data/RAE-Systems.mdb"));
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
if(a==null||a.booleanValue()==false)
{
%>
<script language=JavaScript>
alert('此页面仅对登录用户开放!');
location.href="index.jsp"
</script>
<%
}else{
String admin=request.getParameter("admin");
if (admin==null)
{
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改管理信息</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function check(){
if(post.admin.value==""){
alert("请输入您的用户名");
return false;
}
if(post.admin.value.length>30){
alert("用户名位数不超过15");
return false;
}
if(post.password.value==""){
alert("请输入密码");
return false;
}
if(post.password.value.length>50){
alert("密码位数不超过24");
return false;
}
if(post.password2.value==""){
alert("请输入重复密码");
return false;
}
if(post.password2.value.length>50){
alert("重复密码位数不超过24");
return false;
}
if(post.password.value!=post.password2.value){
alert("输入的两次密码不一致");
return false;
}
return true;
}
</script>
<SCRIPT src="images/index.js"></SCRIPT>
</head>
<body>
<jsp:include page="top.htm" />
<table cellspacing=0 cellpadding=0 width=760 align=center border=0 bgcolor="#FFFFFF">
<tr>
<td width="200" valign=top>
<jsp:include page="left.jsp" />
</td>
<td valign=top class="tdbg_leftall">
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td valign=top>
<table cellspacing=0 cellpadding=0 width="100%" align=center border=0>
<tr>
<td></td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center" style=":break-all;font-family: Arial, Helvetica, sans-serif;">
<tr>
<td width="560">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="28"><table border="1" width="100%" cellspacing="0" cellpadding="0" align="center" bgcolor="#4791C5" >
<tr>
<td width="100%" height="24">
<p align="center">
<font color="#FFFFFF">...::修改管理信息::...</font></td>
</tr>
</table>
<%
String sql="select * from employee where Use_Name='"+Useradmin+"'";
ResultSet Rs=stmt.executeQuery(sql);
while(Rs.next())
{
%>
<form action="config.jsp?" method="post" name="post" id="post" onsubmit="return check();">
<table border="0" width="260" id="table1" align="center">
<tr>
<td>
<p align="right">用户帐号:</td>
<td> <INPUT
name="admin" id="admin" value=<%=Rs.getString("Use_Name")%> size=18></td>
</tr>
<tr>
<td>
<p align="right">用户密码:</td>
<td><span class="f12">
</span><INPUT type=password size=19
value=<%=Rs.getString("Password")%> name="password"></td>
</tr>
<tr>
<td>
<p align="right">重 复 密码:</td>
<td>
<INPUT type=password size=19
value=<%=Rs.getString("Password")%> name="password2"></td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<INPUT type=submit value="确认修改" name=Submit> <INPUT type=reset value="清 除" name=Submit2>
</td>
</tr>
</table>
</form>
<% } %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
}
else
{
String password=request.getParameter("password");
String sql1="update employee set Use_Name='"+admin+"',Password='"+password+"' where Use_Name='"+Useradmin+"'";
try{
stmt.executeUpdate(sql1);
session.invalidate();
%>
<script language=JavaScript>
alert('修改成功,请使用新身份重新登陆系统进行管理!');
location.href="login.jsp"
</script>
<%
}catch(Exception e)
{
response.sendRedirect("error.jsp?error=2");//数据库更新出错!
}
}
if(conn!=null)
{
conn.close();
}
if(stmt!=null)
{
stmt.close();
}
}
%>
解决方案 »
- 关于GenericServlet 源码问题
- struts2中action怎么获取标签里的内容啊
- 怎么在jsp页面上点击按钮就可生成pdf啊
- 在实际项目中,是怎样解决网站安全的问题的?
- 为什么是java.lang.NullPointerException
- 1. Request的应用。在工程中新建一个jsp页面,在页面中实现加减乘除的运算页面,并实现运算结果的计算显示功能
- servlet显示问题?
- echo的中文问题
- jsp tomcat的简单问题。
- 关于jsp引用文件时的中文问题?
- 高分,急!大哥们帮我来看看,解决了马上送分。
- 求助eclipse配置好tomcat启动总报java.lang.ClassFormatError: 感谢
本来我怀疑是String admin=request.getParameter("admin");的admin值本来就有,admin!=null所以不生成下面的table, 但是除了表格别的又都可以显示。连...::修改管理信息::... 也在,所以我怀疑是 <%
String sql="select * from employee where Use_Name='"+Useradmin+"'"; ResultSet Rs=stmt.executeQuery(sql);
while(Rs.next()) {
%>
<form action="config.jsp?" method="post" name="post" id="post" onsubmit="return check();">。。//生成表单
上有问题,不知道大家有没碰到过这样的事情。