用户管理的主页
<
html
>
< head >
< meta http - equiv = " Content-Type " content = " text/html; charset=gb2312 " >
< meta name = " GENERATOR " content = " Microsoft FrontPage 4.0 " >
< meta name = " ProgId " content = " FrontPage.Editor.Document " >
< title > 用户管理 </ title >
< link rel = stylesheet href = " style.css " type = " text/css " >
< style type = " text/css " >
<!--
.style2 ... {
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< div align = " center " >
< center >
< table border = " 0 " width = " 500 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td >& nbsp; </ td >
</ tr >
< tr >
< td width = " 100% " >
<% String sqlname;
int intPageSize;
int intRowCount; // 记录总数
int intPageCount; // 总页数
int intPage; // 页面参数
String strPage; // 定义变量用来传递page
int i,j;
intPageSize = 10 ; // 定义每页显示10条记录
strPage = request.getParameter( " page " ); // 取得当前的页码
if (strPage == null ) ... {//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
} else ... {
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
sqlname = " select count(*) from users order by id desc " ;
ResultSet rt = stmt.executeQuery(sqlname);
rt.next();
intRowCount = rt.getInt( 1 ); // 取得整数保存与intRowCount变量中
intPageCount = (intRowCount + intPageSize - 1 ) / intPageSize; // 计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if (intPage > intPageCount)
intPage = intPageCount;
sqlname = " select * from users order by id desc " ;
ResultSet rs = stmt.executeQuery(sqlname); // 执行sql,按照时间先后排序显示
i = (intPage - 1 ) * intPageSize;
for (j = 0 ;j < i;j ++ )
rs.next(); %>
<%-- 设置intPage参数 --%>
< div align = " center " >
< center >
< table width = " 530 " border = " 0 " cellpadding = " 0 " cellspacing = " 1 " bordercolor = " #FFFFFF " bordercolorlight = " #000000 " bordercolordark = " #FFFFFF " >
< tr >
< td bgcolor = " #000000 " >
< table width = " 100% " border = " 0 " cellpadding = " 5 " cellspacing = " 1 " bgcolor = " #000000 " >
< tr bgcolor = " #00CCCC " >
< td height = " 24 " width = " 55 " align = " center " >
< font color = " #000000 " > 用户编号 </ font ></ td >
< td width = " 65 " align = " center " >< font color = " #000000 " > 用户姓名 </ font ></ td >
< td width = " 120 " align = " center " >< font color = " #000000 " > 电话 </ font ></ td >
< td width = " 190 " align = " center " >< font color = " #000000 " > 地址 </ font ></ td >
< td width = " 100 " align = " center " >< font color = " #000000 " > 操作 </ font ></ td >
</ tr >
<% if (intRowCount == 0 ) ... {%>
<%} else ... {%>
<%-- 显示每页的数据 (根据i的值判断每页的10条记录) --%>
<%
i=0;
while(i<intPageSize && rs.next())...{
%>
<tr bgcolor="#A2DFEA">
<td height="24" align="center"><font color="#000000"><%=rs.getInt("id")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_name")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_phone")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_caddr")%></font></td>
<td align="center"><font color="#000000">
<a href='useradd.jsp'>添加</a>
<a href="usermodify.jsp?userid=<%=rs.getInt("id")%>">修改</a>
<a href='javascript:if(confirm("真的要删除这用户吗?"))window.location="userdel.jsp?userid=<%=rs.getInt("id")%>";'>删除</a>
</font></td>
</tr>
<%i++;//通过I循环设置每页的页数
}
}
rs.close();
stmt.close();
conn.close();
%>
</ table >
</ td >
</ tr >
</ table >
</ div >
</ table >
</ div >
< table width = " 530 " border = " 0 " align = " center " bgcolor = " #CCCCCC " >
< tr >
< td height = " 17 " valign = " middle " bgcolor = " #0099CC " >
< FORM action = new .jsp method = POST >
< p align = ' center ' vAlign = ' bottom ' > 第 <%= intPage %> 页 & nbsp; & nbsp; & nbsp;共 <%= intPageCount %> 页 & nbsp; & nbsp; & nbsp;
<% if (intPage < intPageCount) ... {%>
<a href="yj_usergl.jsp?page=<%=intPage+1%>">下一页</a>
<%} %>
<% if (intPage > 1 ) ... {%>
<a href="yj_usergl.jsp?page=<%=intPage-1%>">上一页</a>
<%} %>
</ form >
</ td >
</ tr >
</ table >
</ body >
</ html >
< head >
< meta http - equiv = " Content-Type " content = " text/html; charset=gb2312 " >
< meta name = " GENERATOR " content = " Microsoft FrontPage 4.0 " >
< meta name = " ProgId " content = " FrontPage.Editor.Document " >
< title > 用户管理 </ title >
< link rel = stylesheet href = " style.css " type = " text/css " >
< style type = " text/css " >
<!--
.style2 ... {
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< div align = " center " >
< center >
< table border = " 0 " width = " 500 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td >& nbsp; </ td >
</ tr >
< tr >
< td width = " 100% " >
<% String sqlname;
int intPageSize;
int intRowCount; // 记录总数
int intPageCount; // 总页数
int intPage; // 页面参数
String strPage; // 定义变量用来传递page
int i,j;
intPageSize = 10 ; // 定义每页显示10条记录
strPage = request.getParameter( " page " ); // 取得当前的页码
if (strPage == null ) ... {//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
} else ... {
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
sqlname = " select count(*) from users order by id desc " ;
ResultSet rt = stmt.executeQuery(sqlname);
rt.next();
intRowCount = rt.getInt( 1 ); // 取得整数保存与intRowCount变量中
intPageCount = (intRowCount + intPageSize - 1 ) / intPageSize; // 计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if (intPage > intPageCount)
intPage = intPageCount;
sqlname = " select * from users order by id desc " ;
ResultSet rs = stmt.executeQuery(sqlname); // 执行sql,按照时间先后排序显示
i = (intPage - 1 ) * intPageSize;
for (j = 0 ;j < i;j ++ )
rs.next(); %>
<%-- 设置intPage参数 --%>
< div align = " center " >
< center >
< table width = " 530 " border = " 0 " cellpadding = " 0 " cellspacing = " 1 " bordercolor = " #FFFFFF " bordercolorlight = " #000000 " bordercolordark = " #FFFFFF " >
< tr >
< td bgcolor = " #000000 " >
< table width = " 100% " border = " 0 " cellpadding = " 5 " cellspacing = " 1 " bgcolor = " #000000 " >
< tr bgcolor = " #00CCCC " >
< td height = " 24 " width = " 55 " align = " center " >
< font color = " #000000 " > 用户编号 </ font ></ td >
< td width = " 65 " align = " center " >< font color = " #000000 " > 用户姓名 </ font ></ td >
< td width = " 120 " align = " center " >< font color = " #000000 " > 电话 </ font ></ td >
< td width = " 190 " align = " center " >< font color = " #000000 " > 地址 </ font ></ td >
< td width = " 100 " align = " center " >< font color = " #000000 " > 操作 </ font ></ td >
</ tr >
<% if (intRowCount == 0 ) ... {%>
<%} else ... {%>
<%-- 显示每页的数据 (根据i的值判断每页的10条记录) --%>
<%
i=0;
while(i<intPageSize && rs.next())...{
%>
<tr bgcolor="#A2DFEA">
<td height="24" align="center"><font color="#000000"><%=rs.getInt("id")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_name")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_phone")%></font></td>
<td align="center"><font color="#000000"><%=rs.getString("user_caddr")%></font></td>
<td align="center"><font color="#000000">
<a href='useradd.jsp'>添加</a>
<a href="usermodify.jsp?userid=<%=rs.getInt("id")%>">修改</a>
<a href='javascript:if(confirm("真的要删除这用户吗?"))window.location="userdel.jsp?userid=<%=rs.getInt("id")%>";'>删除</a>
</font></td>
</tr>
<%i++;//通过I循环设置每页的页数
}
}
rs.close();
stmt.close();
conn.close();
%>
</ table >
</ td >
</ tr >
</ table >
</ div >
</ table >
</ div >
< table width = " 530 " border = " 0 " align = " center " bgcolor = " #CCCCCC " >
< tr >
< td height = " 17 " valign = " middle " bgcolor = " #0099CC " >
< FORM action = new .jsp method = POST >
< p align = ' center ' vAlign = ' bottom ' > 第 <%= intPage %> 页 & nbsp; & nbsp; & nbsp;共 <%= intPageCount %> 页 & nbsp; & nbsp; & nbsp;
<% if (intPage < intPageCount) ... {%>
<a href="yj_usergl.jsp?page=<%=intPage+1%>">下一页</a>
<%} %>
<% if (intPage > 1 ) ... {%>
<a href="yj_usergl.jsp?page=<%=intPage-1%>">上一页</a>
<%} %>
</ form >
</ td >
</ tr >
</ table >
</ body >
</ html >
用户添加的也面
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户添加 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< form name ="form1" method ="post" action ="useradd_save.jsp" onsubmit ="javaScript:return check_validate(this);" >
< table width ="530" border ="0" >
< tr >
< td >< div align ="right" > 用户姓名: </ div ></ td >
< td >< input name ="username" type ="text" size ="14" maxlength ="7" ></ textarea ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 用户密码: </ div ></ td >
< td width ="83%" >< input name ="password" type ="password" size ="18" maxlength ="9" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 重复密码: </ div ></ td >
< td width ="83%" >< input name ="password1" type ="password" size ="18" maxlength ="9" ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户电话: </ div ></ td >
< td >< input name ="userphone" type ="text" size ="32" maxlength ="16" ></ textarea ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户地址: </ div ></ td >
< td >< input name ="usercaddr" type ="text" size ="40" maxlength ="20" ></ textarea ></ td >
</ tr >
< tr >
< td > </ td >
< td > </ td >
</ tr >
< tr >
< td colspan ="2" >
< div align ="center" >
< input type ="submit" name ="Submit" value ="提交" >
< input name ="reset" type ="reset" value ="重置" >
< input type ="button" name ="return" value ="返回" onClick ="javascript:window.history.back();" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< Script Language ="javaScript" > ...
function check_validate(theForm) ...{
if (theForm.password.value!=theForm.password1.value) ...{
alert("两次密码不一样!");
theForm.password.focus();
return false;
}
if (isSpace(theForm.username.value)) ...{
alert("用户名称不能为空!");
theForm.username.focus();
return false;
}
DisableAll(theForm);
return true;
}
function DisableAll(form) ...{
var i=0;
for (i=0;i<form.elements.length;i++) ...{
if (form.elements[i].type == "submit" || form.elements[i].type == "button") ...{
form.elements[i].disabled = true;
}
}
}
function isSpace(str) ...{
var len = str.length;
for(var i=0; i< len; i++) ...{
temp = str.substring(i,i+1);
if (temp != " ") ...{
return false;
}
}
return true;
}
</ Script >
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户添加 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< form name ="form1" method ="post" action ="useradd_save.jsp" onsubmit ="javaScript:return check_validate(this);" >
< table width ="530" border ="0" >
< tr >
< td >< div align ="right" > 用户姓名: </ div ></ td >
< td >< input name ="username" type ="text" size ="14" maxlength ="7" ></ textarea ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 用户密码: </ div ></ td >
< td width ="83%" >< input name ="password" type ="password" size ="18" maxlength ="9" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 重复密码: </ div ></ td >
< td width ="83%" >< input name ="password1" type ="password" size ="18" maxlength ="9" ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户电话: </ div ></ td >
< td >< input name ="userphone" type ="text" size ="32" maxlength ="16" ></ textarea ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户地址: </ div ></ td >
< td >< input name ="usercaddr" type ="text" size ="40" maxlength ="20" ></ textarea ></ td >
</ tr >
< tr >
< td > </ td >
< td > </ td >
</ tr >
< tr >
< td colspan ="2" >
< div align ="center" >
< input type ="submit" name ="Submit" value ="提交" >
< input name ="reset" type ="reset" value ="重置" >
< input type ="button" name ="return" value ="返回" onClick ="javascript:window.history.back();" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< Script Language ="javaScript" > ...
function check_validate(theForm) ...{
if (theForm.password.value!=theForm.password1.value) ...{
alert("两次密码不一样!");
theForm.password.focus();
return false;
}
if (isSpace(theForm.username.value)) ...{
alert("用户名称不能为空!");
theForm.username.focus();
return false;
}
DisableAll(theForm);
return true;
}
function DisableAll(form) ...{
var i=0;
for (i=0;i<form.elements.length;i++) ...{
if (form.elements[i].type == "submit" || form.elements[i].type == "button") ...{
form.elements[i].disabled = true;
}
}
}
function isSpace(str) ...{
var len = str.length;
for(var i=0; i< len; i++) ...{
temp = str.substring(i,i+1);
if (temp != " ") ...{
return false;
}
}
return true;
}
</ Script >
</ body >
</ html >
用户添加提交页面
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 确认添加用户 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
<% ...
request.setCharacterEncoding("GB2312");
String username=request.getParameter("username");
String password = request.getParameter("password");
String userphone = request.getParameter("userphone");
String usercaddr = request.getParameter("usercaddr");
String sqlstr;
%>
< H1 >< CENTER >
用户资料添加确认
</ CENTER ></ H1 >
< form method ="post" action ="--WEBBOT-SELF--" >
< br > < h1 align ="center" >< font color ="#FF0000" > 添加成功! </ font ></ h1 >
< table width =430 border ="0" cellpadding ="5" cellspacing ="1" bgcolor ="#000000" align ="center" >
< tr bgcolor ="#00CCCC" >
< td height ="24" width ="65" align ="center" >
< font color ="#000000" > 用户姓名 </ font ></ td >
< td width ="55" align ="center" >< font color ="#000000" > 用户密码 </ font ></ td >
< td width ="120" align ="center" >< font color ="#000000" > 电话 </ font ></ td >
< td width ="190" align ="center" >< font color ="#000000" > 地址 </ font ></ td >
</ tr >
< tr bgcolor ="#A2DFEA" >
< td height ="24" align ="center" >< font color ="#000000" > <% = username %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = password %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = userphone %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = usercaddr %> </ font ></ td >
</ tr >
</ table >
<% ...
try {
sqlstr = "insert into users (user_name,user_pwd,user_phone,user_caddr)"
+" values('"+username+"','"+password+"','"+userphone+"','"+usercaddr+"')";
stmt.executeUpdate(sqlstr);
stmt.close();
conn.close();
}
catch (SQLException e5)
{
out.println("SQLException5:" +e5.getMessage());
}
%>
< br >
< p align ="center" >
< a href ="usergl.jsp" > 返回用户管理 </ a >
</ p >
</ form >
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 确认添加用户 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
<% ...
request.setCharacterEncoding("GB2312");
String username=request.getParameter("username");
String password = request.getParameter("password");
String userphone = request.getParameter("userphone");
String usercaddr = request.getParameter("usercaddr");
String sqlstr;
%>
< H1 >< CENTER >
用户资料添加确认
</ CENTER ></ H1 >
< form method ="post" action ="--WEBBOT-SELF--" >
< br > < h1 align ="center" >< font color ="#FF0000" > 添加成功! </ font ></ h1 >
< table width =430 border ="0" cellpadding ="5" cellspacing ="1" bgcolor ="#000000" align ="center" >
< tr bgcolor ="#00CCCC" >
< td height ="24" width ="65" align ="center" >
< font color ="#000000" > 用户姓名 </ font ></ td >
< td width ="55" align ="center" >< font color ="#000000" > 用户密码 </ font ></ td >
< td width ="120" align ="center" >< font color ="#000000" > 电话 </ font ></ td >
< td width ="190" align ="center" >< font color ="#000000" > 地址 </ font ></ td >
</ tr >
< tr bgcolor ="#A2DFEA" >
< td height ="24" align ="center" >< font color ="#000000" > <% = username %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = password %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = userphone %> </ font ></ td >
< td align ="center" >< font color ="#000000" > <% = usercaddr %> </ font ></ td >
</ tr >
</ table >
<% ...
try {
sqlstr = "insert into users (user_name,user_pwd,user_phone,user_caddr)"
+" values('"+username+"','"+password+"','"+userphone+"','"+usercaddr+"')";
stmt.executeUpdate(sqlstr);
stmt.close();
conn.close();
}
catch (SQLException e5)
{
out.println("SQLException5:" +e5.getMessage());
}
%>
< br >
< p align ="center" >
< a href ="usergl.jsp" > 返回用户管理 </ a >
</ p >
</ form >
</ body >
</ html >
用户修改页面
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户修改 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< form name ="form1" method ="post" action ="yj_usermodify_save.jsp" onsubmit ="javaScript:return check_validate(this);" >
< table width ="530" border ="0" >
<% ...
request.setCharacterEncoding("gb2312");
int userid = Integer.parseInt(request.getParameter("userid"));
try {
String sql = "select user_name,user_pwd,user_phone,user_caddr from users where id="+userid;
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
String username=rs.getString(1);
String password=rs.getString(2);
String userphone=rs.getString(3);
String usercaddr=rs.getString(4);
%>
< tr >
< td >< div align ="right" > 用户姓名: </ div ></ td >
< td >< input name ="username" type ="text" size ="14" maxlength ="7" value ="<%=username%>" ></ textarea >
< input type ="hidden" name ="userid" value ="<%=userid%>" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 用户密码: </ div ></ td >
< td width ="83%" >< input name ="password" type ="password" size ="18" maxlength ="9" value ="<%=password%>" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 重复密码: </ div ></ td >
< td width ="83%" >< input name ="password1" type ="password" size ="18" maxlength ="9" value ="<%=password%>" ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户电话: </ div ></ td >
< td >< input name ="userphone" type ="text" size ="32" maxlength ="16" value ="<%=userphone%>" ></ textarea ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户地址: </ div ></ td >
< td >< input name ="usercaddr" type ="text" size ="40" maxlength ="20" value ="<%=usercaddr%>" ></ textarea ></ td >
</ tr >
<% ... }
rs.close();
stmt.close();
conn.close();
}
catch (SQLException e3)
{
out.println("SQLException3:" +e3.getMessage());
}
%>
< tr >
< td > </ td >
< td > </ td >
</ tr >
< tr >
< td colspan ="2" >
< div align ="center" >
< input type ="submit" name ="Submit" value ="提交" >
< input name ="reset" type ="reset" value ="重置" >
< input type ="button" name ="return" value ="返回" onClick ="javascript:window.history.back();" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< Script Language ="javaScript" > ...
function check_validate(theForm) ...{
if (theForm.password.value!=theForm.password1.value) ...{
alert("两次密码不一样!");
theForm.password.focus();
return false;
}
if (isSpace(theForm.username.value)) ...{
alert("用户名称不能为空!");
theForm.username.focus();
return false;
}
DisableAll(theForm);
return true;
}
function DisableAll(form) ...{
var i=0;
for (i=0;i<form.elements.length;i++) ...{
if (form.elements[i].type == "submit" || form.elements[i].type == "button") ...{
form.elements[i].disabled = true;
}
}
}
function isSpace(str) ...{
var len = str.length;
for(var i=0; i< len; i++) ...{
temp = str.substring(i,i+1);
if (temp != " ") ...{
return false;
}
}
return true;
}
</ Script >
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户修改 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
< form name ="form1" method ="post" action ="yj_usermodify_save.jsp" onsubmit ="javaScript:return check_validate(this);" >
< table width ="530" border ="0" >
<% ...
request.setCharacterEncoding("gb2312");
int userid = Integer.parseInt(request.getParameter("userid"));
try {
String sql = "select user_name,user_pwd,user_phone,user_caddr from users where id="+userid;
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
String username=rs.getString(1);
String password=rs.getString(2);
String userphone=rs.getString(3);
String usercaddr=rs.getString(4);
%>
< tr >
< td >< div align ="right" > 用户姓名: </ div ></ td >
< td >< input name ="username" type ="text" size ="14" maxlength ="7" value ="<%=username%>" ></ textarea >
< input type ="hidden" name ="userid" value ="<%=userid%>" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 用户密码: </ div ></ td >
< td width ="83%" >< input name ="password" type ="password" size ="18" maxlength ="9" value ="<%=password%>" ></ td >
</ tr >
< tr >
< td width ="17%" >< div align ="right" > 重复密码: </ div ></ td >
< td width ="83%" >< input name ="password1" type ="password" size ="18" maxlength ="9" value ="<%=password%>" ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户电话: </ div ></ td >
< td >< input name ="userphone" type ="text" size ="32" maxlength ="16" value ="<%=userphone%>" ></ textarea ></ td >
</ tr >
< tr >
< td >< div align ="right" > 用户地址: </ div ></ td >
< td >< input name ="usercaddr" type ="text" size ="40" maxlength ="20" value ="<%=usercaddr%>" ></ textarea ></ td >
</ tr >
<% ... }
rs.close();
stmt.close();
conn.close();
}
catch (SQLException e3)
{
out.println("SQLException3:" +e3.getMessage());
}
%>
< tr >
< td > </ td >
< td > </ td >
</ tr >
< tr >
< td colspan ="2" >
< div align ="center" >
< input type ="submit" name ="Submit" value ="提交" >
< input name ="reset" type ="reset" value ="重置" >
< input type ="button" name ="return" value ="返回" onClick ="javascript:window.history.back();" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< Script Language ="javaScript" > ...
function check_validate(theForm) ...{
if (theForm.password.value!=theForm.password1.value) ...{
alert("两次密码不一样!");
theForm.password.focus();
return false;
}
if (isSpace(theForm.username.value)) ...{
alert("用户名称不能为空!");
theForm.username.focus();
return false;
}
DisableAll(theForm);
return true;
}
function DisableAll(form) ...{
var i=0;
for (i=0;i<form.elements.length;i++) ...{
if (form.elements[i].type == "submit" || form.elements[i].type == "button") ...{
form.elements[i].disabled = true;
}
}
}
function isSpace(str) ...{
var len = str.length;
for(var i=0; i< len; i++) ...{
temp = str.substring(i,i+1);
if (temp != " ") ...{
return false;
}
}
return true;
}
</ Script >
</ body >
</ html >
用户删除页面
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户删除 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
<% ...
request.setCharacterEncoding("GB2312");
int userid = Integer.parseInt(request.getParameter("userid"));
String sql= "delete from njruiquan.users where id="+userid;
%>
< H1 >< CENTER > 用户资料删除确认 </ CENTER ></ H1 >
<% ...
try {
stmt.executeUpdate(sql);
stmt.close();
conn.close();
}
catch (SQLException e3)
{
out.println("SQLException3:" +e3.getMessage());
}
out.println("<script language='javascript'>alert('用户编号为"+userid+"用户删除成功');window.location.href='yj_usergl.jsp';</script>");
%>
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< meta name ="GENERATOR" content ="Microsoft FrontPage 4.0" >
< meta name ="ProgId" content ="FrontPage.Editor.Document" >
< title > 用户删除 </ title >
< link rel =stylesheet href ="style.css" type ="text/css" >
< style type ="text/css" > ...
<!--
.style2 {...}{
font-size: 11pt;
color: #FF3300;
}
-->
</ style >
</ head >
< body >
<% ...
request.setCharacterEncoding("GB2312");
int userid = Integer.parseInt(request.getParameter("userid"));
String sql= "delete from njruiquan.users where id="+userid;
%>
< H1 >< CENTER > 用户资料删除确认 </ CENTER ></ H1 >
<% ...
try {
stmt.executeUpdate(sql);
stmt.close();
conn.close();
}
catch (SQLException e3)
{
out.println("SQLException3:" +e3.getMessage());
}
out.println("<script language='javascript'>alert('用户编号为"+userid+"用户删除成功');window.location.href='yj_usergl.jsp';</script>");
%>
</ body >
</ html >