//list.jsp部分 <div class='page fix'> 共 <b>${page.totalNumber}</b> 条 <c:if test="${page.currentPage != 1}"> <a href="javascript:changeCurrentPage('1')" class='first'>首页</a> <a href="javascript:changeCurrentPage('${page.currentPage-1}')" class='pre'>上一页</a> </c:if> 当前第<span>${page.currentPage}/${page.totalPage}</span>页 <c:if test="${page.currentPage != page.totalPage}"> <a href="javascript:changeCurrentPage('${page.currentPage+1}')" class='next'>下一页</a> <a href="javascript:changeCurrentPage('${page.totalPage}')" class='last'>末页</a> </c:if> 跳至 <input id="currentPageText" type='text' value='${page.currentPage }' class='allInput w28' /> 页 <a href='javascript:changeCurrentPage($('#currentPageText').val()') class='go'>GO</a> </div> //list.js部分 /** * 修改当前页码,调用后台重新查询 */ function changeCurrentPage(currentPage){ $("#currentPage").val(currentPage); $("#mainForm").submit(); } //控制台提示 2016-12-21 09:48:34,151 [http-apr-8080-exec-9] DEBUG [com.imooc.dao.IMessage.queryMessageList] - ==> Preparing: select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE order by ID limit ?,? 2016-12-21 09:48:34,152 [http-apr-8080-exec-9] DEBUG [com.imooc.dao.IMessage.queryMessageList] - ==> Parameters: 0(Integer), 5(Integer) 2016-12-21 09:48:34,152 [http-apr-8080-exec-9] DEBUG [com.imooc.dao.IMessage.queryMessageList] - <== Total: 5
提交的值老是为0,无法变成5。这是哪的问题呢?
<input type="hidden"……/>这行你写了吗
<input id="currentPageText" type='text' value='${page.currentPage }' class='allInput w28' /> 页
<a href='javascript:changeCurrentPage($('#currentPageText').val()') class='go'>
你在id="currentPageText" 后面再加一个name="currentPageText"
跳至 <input id="currentPageText" type='text' value='${page.currentPage }' class='allInput w28' /> 页
------------------------------------------------------------------------------
java代码里有没有根据上面的id来正确获取要跳到哪页的页码值?