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

📄 admin_user.jsp

📁 JSP入门与提高.大量丰富的实例。
💻 JSP
字号:
<html>
<head>
<%@ page contentType="text/html;charset=gb2312" %>
<title>会员管理</title>
<link rel=stylesheet href="../style.css" type="text/css">
<script LANGUAGE="javascript">
function newwin(url) {
  var newwin=window.open(url,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=450");
  newwin.focus();
  return false;
}
</script>
</head>
<body>
<script LANGUAGE="javascript">
function submit10()
{
self.location.replace("admin_user.jsp")
}
</script>
<jsp:include page="../top.jsp" flush="true"/>
<center><p><h4><font color="blue">会员管理</font></h4></p>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="adminBean" scope="page" class="firm.firm" />
<%
//指定行数
int pageLine=10;
int totalRec=0;
int totalSub=0;
int intPage=1;
int i;
if (request.getParameter("page")!=null)
intPage=Integer.parseInt(request.getParameter("page"));

try{
ResultSet countrs=null;

//取得总记录数
countrs=adminBean.executeQuery("select count(*) as cnt from user where name<>'administrator'");
if (countrs.next())
 totalRec=countrs.getInt("cnt");
countrs.close();
adminBean.closeStmt();

}
catch(Exception e){
   e.printStackTrace();
}

//取得总页数
int intPageCount=0;
intPageCount = (totalRec+pageLine-1) / pageLine;
%>
<%
ResultSet RS = adminBean.executeQuery("SELECT * FROM user  where name<>'administrator' order by id desc");
String name;
String userid;

%>
<table border='1' cellspacing='0' width='500' bgcolor='#d7e3b9' bordercolorlight='#green' bordercolordark='#ECF5FF'>
<tr bgcolor='#c8cc98' align='center'>
   <td width='8%'>ID</td>
   <td width='14%'>会员名</td>
   <td width='8%' >删除</td>
</tr>
<%
if (intPageCount>0)
{
           for(i=1;i<=(intPage-1)*pageLine;i++)
			RS.next();
	   for(i=1;i<=pageLine;i++) {
			if (RS.next()) {

                        name=RS.getString("name");
                        userid=RS.getString("id");
%>
<tr>
   <td width='8%' align='center'><%=userid%></td>
   <td width='14%' align='center'><%=name%></td>
   <td width='8%' align='center'><a href="delete.jsp?id=<%=userid%>" onClick="return newwin(this.href);">删除</a></td>
</tr>
<%
  }
}
RS.close();
}
%>
<!--以下用于分页显示 -->
<%
 out.print("<tr>");  
 if (intPageCount*pageLine<totalRec) 
   intPageCount++;
 if (intPage>intPageCount )
		intPage=intPageCount;
 if (intPage < 1 )
		intPage=1;
		out.print("<form method='POST'  name=fPageNum  action='admin_user.jsp'>");
		out.print("<p align='left'>&gt;&gt;分页&nbsp;");
  	
  	if (intPage<2)
    		out.print("<font color='999966'>首页 上一页</font>&nbsp;");
  	else{   
  		out.print("<a href='admin_user.jsp?page=1'>首页</a>&nbsp;");   
    		out.print("<a href='admin_user.jsp?page=" + (intPage-1) + "'>上一页</a>&nbsp;"   );
    	}
  	
  	  
  	if( intPage-intPageCount>=0 )
    		out.print("<font color='999966'>下一页 尾页</font>"   );
  	else{   
  		
    		out.print("<a href='admin_user.jsp?page=" + (intPage+1)+ "'>下一页</a> <a href='admin_user.jsp?page=" + intPageCount + "'>尾页</a>");
    	}
 
        out.print("&nbsp;页次:<strong><font color=red>"+intPage+"</font>/"+intPageCount+"</strong>页 "   );
   	out.print("&nbsp;共<b>"+totalRec+"</b>条记录 <b>"+pageLine+"</b>条/页 "   );
   	out.print(" 转到第<input type='text' name='page' size=2 maxlength=10 class=smallInput value="+intPage+">");   
   	out.print("页<input class=buttonface type='submit'  value='GO'  name='cndok'></span></p></form>"  ); 

	out.print("</td>");
	out.print("</tr>"); 
	
%>
</table></p>
<a href="javascript:window.close();">[关闭]</a>
</center>
<jsp:include page="../bottom.jsp" flush="true"/>
</body>
</html>

⌨️ 快捷键说明

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