看数据库的驱动与连接是否做好,看admin3_jsp 的121行是什么?
解决方案 »
- 使用httpclient忽略ssl证书访问网站出错java.security.NoSuchAlgorithmException
- SSH框架中Hibernate对session的管理
- 论坛信息提示功能
- JDBC rollback failed 的问题 -------在线等解答----急急急!!!!!!
- 大家看看我的代码有什么问题(关于ajax的)
- 项目原型
- 关于getOutputStream() has already been called for this response的问题
- datasource和connection pool有什么区别和联系?
- 请教关于java 正则表达式的使用遇到的问题
- 幼稚问题
- tomcat架设jsp服务器问题
- win2k + Tomcat5.0 + jsp 中文文件名下载出错,该怎样解决??
<%@ include file="conn.jsp"%>
<%!
String replacenull(String a){
if(a==null){
return " ";
}else{
return a;
}
}
String selected(String a,String b){
if(a.equals(b)){
return "selected";
}else{
return "";
}
}
String checked(String a,String b){
if(a.equals(b)){
return "checked";
}else{
return "";
}
}
%>
<html>
<head>
<title>用户注册管理</title>
<style type="text/css">
<!--
.style1 {
font-size: 18pt;
font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<%
String all="1";
String student="2";
String teacher="3";
String admin="4";
String sql;String UserSearch=request.getParameter("UserSearch");
UserSearch=new String(UserSearch.getBytes("iso8859-1"),"gb2312");
if (all.equals(request.getParameter("UserSearch")))
sql="select * from data";
else if(student.equals(request.getParameter("UserSearch")))
sql="select * from data where Title='学生'";
else if(teacher.equals(request.getParameter("UserSearch")))
sql="select * from data where Title='教师'";
else
sql="select * from data where Title='系统管理员'";
ResultSet rs=stmt.executeQuery(sql);
int intPageSize = 10;//每页显示几条
rs.last();//将指针移到最后一条
int intRowCount = rs.getRow();//总记录数
int intPageCount = intRowCount%intPageSize == 0 ? intRowCount/intPageSize : intRowCount/intPageSize+1;
int intPage;//当然是第几页
String strPage;
strPage = request.getParameter("page");
if(strPage == null){
intPage = 1;
}else{
intPage = Integer.parseInt(strPage);
if(intPage > intPageCount){
intPage = intPageCount;
}
} rs.absolute((intPage-1) * intPageSize +1);
rs.previous();//定位到当前页首条的前一条
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height=68>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="68">
<tr>
<td width=64><img border="0" src="image/J1.GIF" width="64" height="68"></td>
<td background="image/J2.GIF" width="100%" height="68" align=center>
<center class="style1">
注 册 用 户 管 理</center>
</td>
<td width="60" height="68"><img border="0" src="image/J3.GIF" width="60" height="68"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign=top>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="image/J4.GIF" width=18 height=280></td>
<td height=280 align="left" valign=top bordercolor="#2A9F55">
<form name="form" action="admin3.jsp" method="post">
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="14%"><strong>快速查找用户:</strong></td>
<td width="10%">
<select name="UserSearch" onChange="javascript:submit()">
<option value="0">选择</option>
<option value="1">列出所有用户</option>
<option value="2">学生</option>
<option value="3">教师</option>
<option value="4">系统管理员</option>
</select>
</td>
<td width="15%"> 用户管理首页</td>
<td width="10%"><input type="submit" name="Submit" value="添加新用户 "></td>
<td width="51%">
</td>
</tr>
</table>
</form>
<p>您现在的位置:注册用户管理 >>
<%
if (all.equals(request.getParameter("UserSearch")))
out.print("<font color=blue>列出所有用户</font>");
else if(student.equals(request.getParameter("UserSearch")))
out.print("<font color=blue>学生</font>");
else if(teacher.equals(request.getParameter("UserSearch")))
out.print("<font color=blue>教师</font>");
else
out.print("<font color=blue>系统管理员</font>");
%>
</p>
<%
int RowCount;
String sqlname1;
String submit1="Del";
if(submit1.equals(request.getParameter("Action")))
{
sqlname1="select count(UserID) from data " ;
ResultSet rt=stmt1.executeQuery(sqlname1);
rt.next();
RowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
for(int i=0;i<=RowCount-1;i++)
{
if(request.getParameter("delid"+i)=="")
{
out.print("<script language=javascript>alert('请选中你所删除的项!');javascript:history.back();</script>");
}else
{
stmt.executeUpdate("delete from data where UserName='"+request.getParameter("delid"+i)+"'");
}
}
}
%>