jsp里面的一个分页的例子

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ page import =  "com.broadvision.commerce.marketmaker.util.SupplierUtils,
  com.broadvision.commerce.util.*,
  com.broadvision.commerce.marketmaker.util.*,
  com.broadvision.commerce.*,
  com.broadvision.components.jsobject.* ,
  com.broadvision.components.bv.targeting.BVI_Table,
  com.broadvision.commerce.rfq.*,
  com.broadvision.commerce.marketmaker.beans.purview.RoleForm,
  java.util.*,
  com.broadvision.components.bv.content.*"%>

<jsp:useBean id="contestForm" scope="session" class="com.broadvision.commerce.marketmaker.beans.rfq.ContestForm"/>
<jsp:useBean id="visitorUtils" scope="session" class="com.broadvision.commerce.marketmaker.util.MKTVisitorUtils" />

<link href="/marketplace/style.css" rel="stylesheet" type="text/css">
<link href="/marketplace/style1.css" rel="stylesheet" type="text/css">

<form action="contest.do" name="contestForm">
        <table width="100%" border="0" cellpadding="0" cellspacing="0"> 
<tr><td height="3"></td></tr>
   <tr><td height="22">
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
     <td width="3" height="22" class="addForm_title_first"></td>
     <td class="addForm_titleName">
     
     <table border="0" cellspacing="0"  cellpadding="0">
     <tr>
       <td width="16" height="16" class="addForm_titleName_pic"></td>
       <td style="paddin-left:5px;font-weight:bold;">
        公开竞价项目列表
       </td>
       </tr>
     </table>
     
     </td>
     <td width="3" class="addForm_title_last"></td>
      </tr>
    </table>     
    </td></tr>
   <tr><td height="3"></td></tr>
   </table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
 <tr align="center">
  <td width="" height="22" nowrap class="listTable_header">项目名称</td>
  <td width="" height="22" nowrap class="listTable_header">项目编号</td>
  <td width="" height="22" nowrap class="listTable_header">采购方公司名称</td>
 </tr>


       
<%
  long tmpPageSize=Long.parseLong(com.broadvision.commerce.marketmaker.util.SystemConfig.getParameter("pagesize_int"));
  long PageCount = contestForm.getContestList().size()/tmpPageSize;
  contestForm.setPageCount(PageCount);
  //out.println("<h1>page count is"+PageCount+"</h1><br>");
  //out.println("<h1>tmpPageSize"+tmpPageSize+"</h1><br>");
  //out.println("<h1>contestForm.getContestList().size() is"+contestForm.getContestList().size()+"</h1><br>");
  //out.println("<h1>contestform.getPageNum() is"+contestForm.getPageNum()+"</h1><br>");
%>


<%int iterator=-1;%>
<logic:iterate id="contest" name="contestForm" type="BVI_Content" property="contestList">
<%
iterator++;
if(iterator>=contestForm.getPageNum()*tmpPageSize&&iterator<tmpPageSize*(contestForm.getPageNum()+1)){
                 //out.println("iterator-------------------------"+iterator);
            //out.println("contestForm.getPageNum()*tmpPageSize-------------------------"+contestForm.getPageNum()*tmpPageSize);
            //out.println("tmpPageSize*(contestForm.getPageNum()+1)-------------------------"+tmpPageSize*(contestForm.getPageNum()+1));
%>
 <tr align="center">
  <td height="22" align="center" nowrap class="listTable_itemSet" style="padding-left:5px;"><A href="contest.do?BV_SessionID=<%=request.getParameter("BV_SessionID")%>&BV_EngineID=<%=request.getParameter("BV_EngineID")%>&formAction=openDetailForSupplierApproveRequest&oid=<%=contest.getStringProperty("OID")%>"> <%=contest.getStringProperty("PROJECT_NAME")%></a></td>
  <td height="22" align="center" nowrap class="listTable_itemSet" style="padding-left:5px;">&nbsp;<%=contest.getStringProperty("PROJECT_CODE")%></td>
  <td height="22" align="center" nowrap class="listTable_itemSet" style="padding-left:5px;">&nbsp;<%=contest.getStringProperty("BUYER_COMPANY_NAME")%></td>
 </tr>
 <%}%>
</logic:iterate>
</table>
<br>

 

  <input type="hidden" name="pageSize">
  <input type="hidden" name="pageCount">
  <input type="hidden" name="pageNum" >
  <input type="hidden" name="BV_SessionID" value="<%=request.getParameter("BV_SessionID")%>">
  <input type="hidden" name="BV_EngineID" value="<%=request.getParameter("BV_EngineID")%>">


<Script language="javascript">
function goPage(aa){
 document.contestForm.pageNum.value=document.contestForm.pageNum1.value;
 document.contestForm.searchBtn.value="上一页";
 document.contestForm.submit();
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="22" align = "right" class="listTable_page">
每页<%=tmpPageSize%>条,
第<jsp:getProperty name="contestForm" property="pageNum" />页,
共<%=PageCount%>页
     <logic:greaterThan name="contestForm" property="pageNum" value='1'>
     <input type="submit" name="searchBtn" class="cool-btn-lite" value="首 页" οnclick="contestForm.pageNum.value='1';">
     </logic:greaterThan>
     <logic:greaterThan name="contestForm" property="pageNum" value='1'>
     <input type="submit" name="searchBtn" class="cool-btn-lite" value="上一页" οnclick="contestForm.pageNum.value='<%=(contestForm.getPageNum()-1)+""%>';">
     </logic:greaterThan>
     <logic:lessThan name="contestForm" property="pageNum" value='<%=contestForm.getPageCount()+""%>'>
     <input type="submit" name="searchBtn" class="cool-btn-lite" value="下一页" οnclick="contestForm.pageNum.value='<%=(contestForm.getPageNum()+1)+""%>';">
     </logic:lessThan>
     <logic:lessThan name="contestForm" property="pageNum" value='<%=contestForm.getPageCount()+""%>'>
     <input type="submit" name="searchBtn" class="cool-btn-lite" value="末 页" οnclick="contestForm.pageNum.value='<%=contestForm.getPageCount()+""%>';">
     </logic:lessThan>

     <!-- add by zjf -->
       第 <select name="pageNum1" onChange="javascript:goPage(1)">
      <%
      int temC=(int)PageCount;
      int temN=(int)contestForm.getPageNum();
      for(long i=1;i<=temC;i++) {
      %>
                          <option value=<%=i%> <%=(temN==i?"selected":"") %> ><%=i %></option>
      <%
      }
      %>
       </select> 页
       </td>
   </tr>
  </table>
  <br>
  </form>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值