打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
分页列表(2014-07-04)
1.
public String answerlist(HttpServletRequest request, Model model, String liId){
int page =  Integer.parseInt(request.getParameter("page"));
int rows = 5;
int total = 0;

//拿出移动列表
if(liId.equals("0")){
yiDongTypeId = problemTypeService.findTypeIdByTypeName(YI_DONG);
yiDongQuestionList = procedureQuestionService.getQuestionsByPage(page, rows, yiDongTypeId);
model.addAttribute("yiDongList", yiDongQuestionList);
total = procedureQuestionService.totalCount(yiDongTypeId);
if(total == 0){
total=1;
}else{
total=total % rows ==0 ? total/rows : total/rows+1;
}
}
model.addAttribute("total", total);
model.addAttribute("cotentPage",page);
return "home/index/answerlist";
}

2.
<script type="text/javascript">
var pageId = '${cotentPage}';
function init(){
var whichLink = document.getElementById("NmN"+pageId);
var box = document.getElementById("Public_Page");
    var links = box.getElementsByTagName("a");
    for (var i = 0; i < links.length; i++) {
          links[i].setAttribute("class", "Public_Page_item ");
          if(whichLink!=null){
              whichLink.setAttribute("class", "Public_Page_item Public_Page_current"); 
          }

      }
}

function change(whichLink) {
    var box = document.getElementById("Public_Page");
    var links = box.getElementsByTagName("a");
    for (var i = 0; i < links.length; i++) {
        links[i].setAttribute("class", "Public_Page_item ");
        whichLink.setAttribute("class", "Public_Page_item Public_Page_current");
    }
}
</script>
<body onload="init();">
<li id="list_li_0"><a href="${servletPath}/zzpz/secondIndex/list.htm?liId=0&page=1">移动常见问题</a></li>

              <!-- 共用翻页模块_Start -->
              <div class="Public_Page" id="Public_Page">
              <c:choose>
              <c:when test="${cotentPage == 1}">
              <span class="Public_Page_prev">上一页</span>
              </c:when>
              <c:otherwise>
    <a href="${servletPath}/zzpz/secondIndex/list.htm?liId=${liId}&page=${cotentPage-1 }" class="Public_Page_prev ">上一页</a>
  </c:otherwise>
              </c:choose>
              
          <c:forEach begin="1" end="${total }"  var="i">
                <a href="${servletPath}/zzpz/secondIndex/list.htm?liId=${liId}&page=${i}" class="Public_Page_item" id="NmN${i }" onclick="change(this);">${i }</a>
              </c:forEach>
           
            <c:choose>
              <c:when test="${cotentPage == total}">
              <span class="Public_Page_prev">下一页</span>
              </c:when>
              <c:otherwise>
    <a href="${servletPath }/zzpz/secondIndex/list.htm?liId=${liId}&page=${cotentPage+1 }" class="Public_Page_next">下一页</a>
  </c:otherwise>
              </c:choose>   
                 
              </div>
              <!-- 共用翻页模块_End --> 


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
MVC+JSON 无限滚动翻页
成功访问库函数
切记ajax中要带上AntiForgeryToken防止CSRF攻击
千年古帖——《石鼓文》全貌
漂亮的前端分页方法
spring-boot(十五)集成solr
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服