📄 vuser.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ include file="../inc/conn1.jsp"%>
<link href="css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<!--DWLayoutTable-->
<tr align="center" valign="middle" >
<td width="900" bgcolor="#ECECE9">
<a href="vuser.jsp?lei=1" >程序设计</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=2" >数据库管理</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=3" >图形处理</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=4">办公自动化</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=5">网络工程</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=6" >计算机硬件</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=7" >计算机辅助</a><img src="../image/line.gif" width=1 height=13 hspace=7 vspace=5 align=absmiddle>
<a href="vuser.jsp?lei=8">综 合 类</a></td>
</tr>
</table>
<br>
<table width="95%" border=0 align="center" cellpadding=0 cellspacing=1>
<!--DWLayoutTable-->
<tr bgcolor="#E6E6E6">
<th width="364" height="13">图书名称</th>
<th width="150">出版社</th>
<th width="140">定价</th>
<th>日期</th>
<th colspan="2" valign="top">操 作</th>
</tr>
<%
//public bs=rs.getString("leiID");
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage,lei;
int i;
//设置一页显示的记录数
intPageSize =15;
//取得待显示页码
strPage = request.getParameter("page");
lei = request.getParameter("lei"); //图书类别
if(lei==null){
lei="1";
}
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
} else{//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
}
sql="select * from tushumingxi where lieID="+java.lang.Integer.parseInt(lei);
Statement selstmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=selstmt.executeQuery(sql);
if(intPage< 1){
intPage = 1;
}
//获取记录总数
rs.last();
intRowCount = rs.getRow();
//记算总页数
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
//调整待显示的页码
if(intPage >intPageCount) intPage = intPageCount;
if(intPageCount >0){
//将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage-1) * intPageSize+1);
//显示数据
}
i = 0;
String bgcolor="#ffffff";
int k=1;
while(i< intPageSize && !rs.isAfterLast()){
%>
<tr valign="middle" bgcolor="<%=bgcolor%>" height="25">
<td width="364" height="18" ><div align="center"><a href=# onClick="MM_openBrWindow('../browbook.jsp?id=','','width=400,height=550')"><%=rs.getString("shu_name")%></a></div></td>
<td><%=rs.getString("banshe")%></td>
<td><div align="center">¥<%=rs.getString("dingjia")%>元</div></td>
<td width="137"><%=rs.getString("date")%></td>
<td colspan="2" nowrap><div align="center"><a href="#">修 改</a>/<a href="#">删 除</a></div> </td>
</tr>
<tr>
<td height=1 colspan="5" background="../image/dian.gif"><img src="../images/blank.gif" width=378 height=1></td>
<td width="64" background="../image/dian.gif"></td>
</tr>
<%
k++;
if(k%2==0)
{bgcolor="#FBEEE1";}
else
{bgcolor="#ffffff";}
rs.next();
i++;
} rs.close();
selstmt.close();
conn.close();%>
</table>
<p align="center">
共<%=intRowCount%>个记录,分<%=intPageCount%>页显示,您所在本页是:第<%=intPageCount%>页
<%for(int j=1;j<=intPageCount;j++)
{out.print(" <a href='vuser.jsp?lei="+lei+"&page="+j+"'>"+j+"</a>");
}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -