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 -->
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。