一聚教程网:一个值得你收藏的教程网站

jsp分页

mg电子:欲借“冷门”艺术吸引客流,成都卖场究竟有着怎样的打算?  抢眼球吸引关注  “成都商业竞争一直很激烈,我们从一开始规划就想开发一个定位特别的商业体,因此我们筹划活动的思路也和别人不一样。

时间:2008-07-10 00:00:00 编辑:简简单单 来源:转载

  jsp分页

public int doStartTag() throws JspException {
        StringBuffer sb = null;
        if (result != null && result.getContent() != null
                && result.getContent().size() > 0) {
            sb = new StringBuffer("分页: ");
            if (result.getPage().getHasPrePage()){
                sb.append("<a href='").append(url);
                if (url.indexOf("?") == -1)
                    sb.append("?page=1");
                else
                    sb.append("&page=1");
                linkParams(sb);
                sb.append("'>").append("首页").append("</a>").append(" | ");
                sb.append("<a href='").append(url);
                if (url.indexOf("?") == -1)
                    sb.append("?page=").append(
                            result.getPage().getPreviousPage());
                else
                    sb.append("&page=").append(
                            result.getPage().getPreviousPage());
                linkParams(sb);
                sb.append("'>").append("上页").append("</a>").append(" | ");
            }
            if (result.getPage().getHasNextPage()) {
                sb.append("<a href='").append(url);
                if (url.indexOf("?") == -1)

 


                    sb.append("?page=").append(result.getPage().getNextPage());
                else
                    sb.append("&page=").append(result.getPage().getNextPage());
                linkParams(sb);
                sb.append("'>").append("下页").append("</a>").append(" | ");
                sb.append("<a href='").append(url);
                if (url.indexOf("?") == -1)
                    sb.append("?page=").append(result.getPage().getTotalPage());
                else
                    sb.append("&page=").append(result.getPage().getTotalPage());
                linkParams(sb);
                sb.append("'>").append("尾页").append("</a>");
            }
            sb
                    .append(" 跳转到:<select name='goToPage' onchange='javascript:goPage(this.value)'>");
            int s = result.getPage().getTotalCount();

 


            for (int i = 1; i <= s; i++) {
                sb.append("<option value=").append(i);
                if (Integer.parseInt(page) == i)
                    sb.append(" selected");
                sb.append(">第").append(i).append("页</option>");
            }
            sb.append("</select>");
            sb.append("<script language=javascript>");
            sb.append("function goPage(page){").append("window.location='")
                    .append(url);
            if (url.indexOf("?") == -1)
                sb.append("?page='+").append("page");
            else
                sb.append("&page='+").append("page");
            sb.append("+'");
            linkParams(sb);
            sb.append("';");

文章评论

热门栏目

合作: 澳门网络赌博 tt娱乐 mg电子