jsp分页
我写了一个分页代码,但是数据不显示,哪个高手能写一个让我参考参考
[最优解释]
我给你一个,你参考下吧
//转到相应的页数
function selectCheck(){
var pageNo = document.getElementById("pageNo").value;
window.location.href="followup.do?operate=doFollowupList&pageNo="+pageNo+"&pageSize=<%=pageSize%>";
}
<%
//第几页
int pageNo = request.getAttribute("pageNo") != null ? Integer
.parseInt(request.getAttribute("pageNo").toString()) : 1;
//每页显示多少条
int pageSize = request.getAttribute("pageSize") != null ? Integer
.parseInt(request.getAttribute("pageSize").toString()) : 20;
%>
<table width="960" border="0" cellspacing="0" cellpadding="0" style="border:1px solid;border-color:#bddfee;margin-top:5px;margin-bottom:5px;">
<tr>
<td width="321" height="36">
当前页:<%=pageNo%>/<%=count % pageSize == 0 ? count / pageSize : count/ pageSize + 1%>页
数据总量:<%=count%>
</td>
<td width="637" align="right">
<a href="followup.do?operate=doFollowupList&pageNo=1&pageSize=<%=pageSize%>">【首页】</a>
<%if (pageNo > 1) {%>
<a href="followup.do?operate=doFollowupList&pageNo=<%=pageNo > 1 ? pageNo - 1 : 1%>&pageSize=<%=pageSize%>">【上一页】</a>
<%} else {%>
<a href="#">【上一页】</a>
<%
}
if (pageNo < (count % pageSize == 0 ? count / pageSize : count/ pageSize + 1)) {
%>
<a href="followup.do?operate=doFollowupList&pageNo=<%=pageNo >= (count % pageSize == 0? count / pageSize: count / pageSize + 1) ? pageNo : pageNo + 1%>&pageSize=<%=pageSize%>">【下一页】</a>
<%} else {%>
<a href="#">【下一页】</a>
<%}%>
<a href="followup.do?operate=doFollowupList&pageNo=<%=count % pageSize == 0 ? count / pageSize : count/ pageSize + 1%>&pageSize=<%=pageSize%>">【尾页】</a>
转到第<select id="pageNo" name="page" onChange="selectCheck()">
<%
String selected = "";
for (int i = 1; i <= (count % pageSize == 0? count / pageSize: count / pageSize + 1); i++) {
if (pageNo == i) {
selected = "selected";
} else {
selected = "";
}
%>
<option <%=selected%> value=<%=i%>><%=i%></option>
<%
}
%>
</select>
</td>
</tr>
</table>
<td width="111"><div align="center"><a href="mod.jsp?date=<%=rst.getString("date") %>" style="color='#000000'">修改</a></div></td>
<td width="111"><div align="center"><a href="main.jsp?date=<%=rst.getString("date") %>" onclick="a()" style="color='#000000'">删除</a></div></td>
</tr>
</table>
<%
}
dao.closeConnection();
%>
<!-- 显示数据代码--结束 -->
</div>
<div class="page">
<table width="800">
<tr>
<td width="800">
[<%=currPage %>/<%=countPage %>]每页10条 共<%=countRow %>条记录
<%
if(currPage > 1) {
%>
<a href="main.jsp?Page=<%=currPage - 1 %>">上一页</a>
<%
}
%>
<%
if(currPage < countPage) {
%>
<a href="main.jsp?Page=<%=currPage + 1 %>">下一页</a>
<%
}
%>
<a href="main.jsp?Page=<%=countPage %>">最后一页</a>
</td>
</tr>
</table>
</div>
[其他解释]
咋不能分页了?抛出了异常信息吗
[其他解释]
哪个高手能解决一下
[其他解释]
谢谢大家,问题已解决!