📄 list.jsp
字号:
<!--- The site is designed by XDevelop.net 2001 --->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ taglib uri="/xdevelop.net/taglibs/page" prefix="page"%>
<%@ page import="net.xdevelop.demo.Records"%>
<%@ page import="net.xdevelop.util.*"%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>结果</title>
<style>
td { FONT-SIZE: 9pt; line-height: 12pt;}
</style>
</head>
<body>
<%
//获取查询参数
String condition=ParamUtil.getParameter(request,"type");
//为了程序的健壮性,请务必考虑直接访问本页情况下的处理,否则有可能出错,这里将其设为默认值
if(condition.equals("")||condition==null) condition="全部";
Records records=new Records();
//获取符合查询条件的所有记录数量
int totalRecords=records.count(condition);
%>
<!--分页显示-->
<page:pager total='<%=totalRecords%>' defaultPageSize="3">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="512" height="79">
<tr>
<td width="510" colspan="4" align="center" bgcolor="#0099FF" height="24">
<font color="#990000"><%=condition%></font> <font color="#FFFFFF">查询结果</font></td>
</tr>
<tr>
<td width="51" height="24" bgcolor="#66CCFF" align="center">
<font color="#FFFFFF">编号</font></td>
<td width="104" height="24" bgcolor="#66CCFF" align="center">
<font color="#FFFFFF">职称</font></td>
<td width="240" height="24" bgcolor="#66CCFF" align="center">
<font color="#FFFFFF">名字</font></td>
<td width="112" height="24" bgcolor="#66CCFF" align="center">
<font color="#FFFFFF">操作</font></td>
</tr>
<%
//records.getRecords()从符合condition的第index条记录起取num条记录
//records.getRecores()方法必须注意越界情况下的处理,
//例如该记录有100条,在分页中有可能出现从第90条取30条记录的情况,这时应该正确返回10条记录集
String[][] recs=records.getRecords(condition,index.intValue(),pageSize.intValue());
if(recs!=null) {
for(int i=0;i<recs.length;i++) {
%>
<tr>
<td width="51" height="12" bgcolor="#C0C0C0" align="center"><%=index.intValue()+i%></td>
<td width="104" height="12" bgcolor="#C0C0C0" align="center"><%=recs[i][0]%></td>
<td width="240" height="12" bgcolor="#C0C0C0" align="center"><%=recs[i][1]%></td>
<td width="112" height="12" bgcolor="#C0C0C0" align="center">
<a href="operate.jsp">操作处理</a></td>
</tr>
<%
}
}
%>
<tr>
<td width="508" height="16" colspan="4" align="center">
<!--导航条-->
<page:navigator type='text'/>
</td>
</tr>
</table>
</page:pager>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -