返回首頁
當前位置: 主頁 > 網絡編程 > Jsp實例教程 >

java普通分頁程序代碼

時間:2010-08-08 02:43來源:知行網www.wzliqi.com 編輯:麥田守望者


<%
int rowCount = 0 ;
int pageSize = 0;
if(request.getAttribute("rowCount")!=null)
{
rowCount = Integer.parseInt((String)request.getAttribute("rowCount"));
pageSize = Integer.parseInt((String)request.getAttribute("pageSize"));
}
if(rowCount>pageSize)
{
%>
<form name="pageform" method="post" action="/zhuanti/Olympic/list.jsp?categoryId=<%= categoryId %>">
<%
String pageCount = (String)request.getAttribute("pageCount");
pageNum = Integer.parseInt((String)request.getAttribute("pageNum"));
%>
共<%=pageCount %>頁&nbsp;&nbsp;&nbsp;&nbsp;
<%
if(pageNum<=1)
{
out.println("首頁&nbsp;&nbsp;&nbsp;上一頁&nbsp;&nbsp;");
}
else
{
%>
<a href='javascript:topage(1)'>首頁</a> &nbsp;
<a href="javascript:topage('<%=pageNum-1 %>')">上一頁</a>&nbsp;&nbsp;
<%
}
if(pageNum>=Integer.parseInt(pageCount))
{
out.println("下一頁&nbsp;&nbsp;&nbsp;末頁&nbsp;&nbsp;");
}
else
{
%>
<a href="javascript:topage('<%=pageNum+1 %>')">下一頁</a>&nbsp;&nbsp;
<a href='javascript:topage(-1)'>末頁</a> &nbsp;&nbsp;
<% } %>
&nbsp;&nbsp;當前第<input name="pageNum" type="text" style="HEIGHT: 18px; WIDTH: 22px; border:1px;" maxlength="4" value="<%=pageNum %>"/>頁
&nbsp;&nbsp;<a href='javascript:go()'>GO</a>


</form>
<%
}
%>
<script language='javascript'>
function topage(id)
{
pageform.pageNum.value=id;
pageform.submit();
}
function go()
{
var pn = pageform.pageNum.value;
pageform.pageNum.value = pn;
pageform.submit();
}
</script>
<!-- 分頁結束 -->

------分隔線----------------------------
標簽(Tag):Java java代碼 java源碼 java實例
------分隔線----------------------------
推薦內容
猜你感興趣
久久99久久99精品免视看