标题:jsp页面实现查询并分页
只看楼主
zhangtao0563
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-8-16
结帖率:0
已结贴  问题点数:20 回复次数:2 
jsp页面实现查询并分页
新手不大会  再点击搜索图片之后应该写上面样的function  然后怎样实现查询并分页  求高手解决
//查询
function checkArc(aid){
   
}





<table border='0' cellpadding='0' cellspacing='0'>
        <tr>
        <td width='90' align='center'>搜索条件:</td>
          <td width='90' align='center'>广告位:</td>
          <td width='160'>        
              <input type="text" name= "adressname"  value='' style='width:150px'/>
          </td>
        <td width='70'>广告名称 </td>
        <td width='160'>
              <input type="text" name="adname" value='' style='width:150px' />
        </td>
        <!--  下面是一张搜索的图片   -->
        <td>
          <input name="imageField" type="image" src="images/frame/search.gif" onClick ="javascript:checkArc(0);" width="45" height="22" border="0" class="np" />
        </td>
       </tr>
      </table>
搜索更多相关主题的帖子: border 搜索图片 function 查询 
2012-08-16 16:06
编程的乐趣
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:1
帖 子:229
专家分:1027
注 册:2011-4-4
得分:20 
上谷歌百度查,有很多的分页写法
2012-08-17 09:12
北方凌云
Rank: 1
等 级:新手上路
威 望:1
帖 子:7
专家分:3
注 册:2012-11-3
得分:0 
public class Page {
        //总页数
        private int totalCountpage=1;
        //每页显示的记录数
        private int sizepage=0;
        //计算的总数
        private int recordcount=0;
        //当前页号
        private int currpageno=1;
        
        public int getCurrpageno() {
            if(totalCountpage==0)
                return 0;
            return currpageno;
        }
        public void setCurrpageno(int currpageno) {
            if(this.currpageno>0)
            this.currpageno = currpageno;
        }
        public int getTotalCountpage() {  //计算总页数时还得要把totalCountpage拿到
            return totalCountpage;
        }
        public void setTotalCountpage(int totalCountpage) {
            this.totalCountpage = totalCountpage;
        }
        public int getSizepage() {
            return sizepage;
        }
        public void setSizepage(int sizepage) {
            if(sizepage>0)
            this.sizepage = sizepage;
        }
        public int getRecordcount() {
            return recordcount;
        }
        public void setRecordcount(int recordcount) {
            if(recordcount>0){
            this.recordcount = recordcount;
            this.setSumpage();//计算总数的时候调用这个方法
        }   
    }

    // 设置总页数=总数量/每页显示的数据量+1
    private void setSumpage(){
        if(this.recordcount%this.sizepage==0)
            this.totalCountpage=this.recordcount/this.sizepage;
        else if(this.recordcount%this.sizepage>0)
            this.totalCountpage=this.recordcount/this.sizepage+1;
        else
            this.totalCountpage=0;
        }
     //得到开始记录数
    public int getStartrow(){
        return (currpageno-1)*sizepage+1;
    }
    //得到结束记录数
    public int getEndrow(){
        return currpageno*sizepage;
       }
}
2012-11-03 11:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-379605-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.019666 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved