第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

共多少條,當前多少頁,共多少頁都不顯示

共 <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>


感覺這段代碼的${page.totalNumber} ?${page.currentPage}/${page.totalPage} 都拿不到值。

但是java調(diào)試的時候page里面的這些屬性都是有值得

正在回答

4 回答

首先你需要看一看你的代表PAGE的實體類的實例的名字是不是起的page,不是的話你前端的名字就得改一下,如果不是這個問題,看一看servlet中有沒有setattribute()把page加入到request作用域中 還沒有的話看看你的PAGE實體類中有沒有給這些屬性設(shè)置GET方法,如果像你說的 調(diào)試的時候有值,那就應該就是這三個問題了

0 回復 有任何疑惑可以回復我~
#1

慕粉18826421674 提問者

servlet的代碼貼在下面了。 page類有對應的set、get方法了
2017-04-05 回復 有任何疑惑可以回復我~

加上這一句就可以了

request.setAttribute("page", page);

0 回復 有任何疑惑可以回復我~

你看,你req.setattribute? 的時候? key? 用的名字是messageList?? 可是你取值的時候是{page.totalPage}?? 你應該是${messageList .totalPage}? 這個樣子,你試試吧,不知道有沒有幫到你

0 回復 有任何疑惑可以回復我~

public class ListServlet extends HttpServlet {


@Override

protected void doGet(HttpServletRequest req, HttpServletResponse resp)

throws ServletException, IOException {

? ? //設(shè)置編碼

req.setCharacterEncoding("UTF-8");

//接收頁面的值

String command = req.getParameter("command");

String description = req.getParameter("description");

String currentPage = req.getParameter("currentPage");

//向頁面?zhèn)髦?/p>

req.setAttribute("command", command);

req.setAttribute("description", description);

req.setAttribute("currentPage", currentPage);

?

Page page = new Page();

Pattern pattern = Pattern.compile("[0-9]{1,9}");

if(currentPage == null || ?!pattern.matcher(currentPage).matches()) {

page.setCurrentPage(1);

} else {

page.setCurrentPage(Integer.valueOf(currentPage));

}

//業(yè)務處理 查詢消息列表并傳遞給頁面

QueryService listServcie = new QueryService();

req.setAttribute("messageList", listServcie.queryMessageList(command, description,page));

//頁面跳轉(zhuǎn)

? ? req.getRequestDispatcher("/WEB-INF/jsp/back/List.jsp").forward(req, resp);

}


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

共多少條,當前多少頁,共多少頁都不顯示

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號