我用StringBuffer作了多条件查询后以前的分页就不管用了,请问这样应该怎么做分页啊??
我用的数据库是oracle。MYSQL那个方法用不了,虽然实现了多条件查询后以前的分页但是还是觉得我用的方法笨笨的,先凑合着用吧,呵呵谢谢大家的热心帮助。
<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="com.cdx.share.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%DBAccess db=new DBAccess("java:comp/env/jdbc/SLLY");%>
<%request.setCharacterEncoding("GB2312");%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<LINK href="../css/cssDefault.css" type=text/css rel=stylesheet>
</head>
<body><table class=table1 cellspacing="1">
<%
String WATERSYSTEM=request.getParameter("WATERSYSTEM");
String D_TYPE=request.getParameter("D_TYPE");
String EA_TIME=request.getParameter("EA_TIME");
String RIVERNAME=request.getParameter("RIVERNAME");
String C_LOCUS=request.getParameter("C_LOCUS");
String D_DATE=request.getParameter("D_DATE");
StringBuffer sql=new StringBuffer("select * from T_DISSENSION t where 1=1 ");
if (WATERSYSTEM!=null&&!"".equals(WATERSYSTEM))
sql.append(" and t.WATERSYSTEM='"+WATERSYSTEM+"'" );
if (D_TYPE!=null&&!"".equals(D_TYPE))
sql.append(" and t.D_TYPE='"+D_TYPE+"'" );
if (EA_TIME!=null&&!"".equals(EA_TIME))
sql.append(" and t.EA_TIME='"+EA_TIME+"'" );
if (RIVERNAME!=null&&!"".equals(RIVERNAME))
sql.append(" and t.RIVERNAME='"+RIVERNAME+"'");
if (C_LOCUS!=null&&!"".equals(C_LOCUS))
sql.append(" and t.C_LOCUS='"+C_LOCUS+"'" );
if (D_DATE!=null&&!"".equals(D_DATE))
sql.append(" and t.D_DATE='"+D_DATE+"'" );
CDXResultSet rs=db.execQuery(sql.toString());
%>
<form name="frm1" method="post" action="DISSENSION.jsp">
<tr>
<td class=td3>选择河系</td>
<td class=td2>
<select name="WATERSYSTEM" class=select2>
<option value="" selected>-河系名称-</option>
<option value="黑龙江水系">黑龙江水系</option>
<option value="乌苏里江水系">乌苏里江水系</option>
<option value="绥芬河水系">绥芬河水系</option>
<option value="图们江水系">图们江水系</option>
<option value="额尔古纳河水系">额尔古纳河水系</option>
<option value="鸭绿江水系">鸭绿江水系</option>
<option value="其它(界湖)">其它(界湖)</option>
</select></td>
<td class=td3>选择类别</td>
<td class=td2>
<SELECT NAME="D_TYPE" class=select2>
<option value="" selected>-类型名称-</option>
<option value="水事纠纷">水事纠纷</option>
<option value="非水事纠纷">非水事纠纷</option>
</SELECT></td>
<td class=td3>审批时间</td>
<td class=td2><input class=text3 type="text" name="EA_TIME" value=""></td>
</tr>
<tr>
<td class=td3>河流名称</td>
<td class=td2><input class=text3 type="text" name="RIVERNAME" value=""></td>
<td class=td3>所在县市</td>
<td class=td2><input class=text3 type="text" name="C_LOCUS" value=""></td>
<td class=td3>时间</td>
<td class=td2><input class=text3 type="text" name="D_DATE" value=""></td>
</tr>
<tr class=trbottom>
<td colspan="6">
<input name=Submit type=image "img src="../images/button/btnQuery.gif" border="0">
<a href="DISSENSION_register.jsp"><img src="../images/button/btnAdd.gif" border="0"></a>
<input name=Back type=image "img src="../images/button/btnBack.gif" onClick="history.back(-1)" border="0"></td>
</tr>
</table>
</form>
<table class=table1 cellspacing="1">
<tr class=trhead>
<td width="16%">河流名称</td>
<td width="18%">所在县市</td>
<td width="18%">时间</td>
<td width="18%">类型</td>
<td width="15%">照会内容</td>
<td width="15%">备注</td>
</tr>
<%
while(rs.next()){
%>
<tr class=tr1>
<td><%=rs.getString("RIVERNAME")%></td>
<td><%=rs.getString("C_LOCUS")%></td>
<td><%=rs.getString("D_DATE")%></td>
<td><%=rs.getString("D_TYPE")%></td>
<td><%=rs.getString("NOTE")%></td>
<td><%=rs.getString("REMARK")%></td>
</tr>
<%}}%>
<tr class=trbottom>
<td colspan="6" >
</td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2006-9-25 9:43:37编辑过]