您现在的位置: 破洛洛 >> 建站学院 >> 网站开发 >> JSP教程 >> 正文

jsp分页技术代码奉献

作者:佚名 来源:网络整理 更新时间:2008-12-26
分享到

public static final String splitPages2(int thePage, String queryString, int count,

                int pageLength)

        {

            int maxPage = count / pageLength + 1;

            int prevPage = thePage - 1;

            if (prevPage < 1)

            {

                prevPage = 1;

            }

            int nextPage = thePage + 1;

            int showMaxPage = thePage + 6;

            int spacePage = 1;

            if (thePage > 6)

            {

                spacePage = thePage - 5;

            }

            if (showMaxPage < 10)

            {

                showMaxPage = 10;

            }

    //<p class="fy"><a class="back" href="">上一页</a><a href="">01</a><a href="">02</a><a href="">03</a><a class="next" href="">下一页</a></p>

            StringBuffer sb = new StringBuffer();

            sb.append("<p class=\"fy\"> <a href=\""+queryString+"\">第一页</a>");

            sb.append("<a class=\"back\" href=\"" + queryString + "&pagex=" + prevPage

                    + "\">上一页</a>");

            for (int i = spacePage; i < showMaxPage && i <= maxPage; i++)

            {

         &nbs

转载请注明:破洛洛(谢谢合作)
网友评论: