1
我有一个非常简单的自定义JSP标记,用于生成分页链接。它去大致如下:JSP/JSTL:'2> 10'评估为true
<span id="${id}" class="paginationLinks ${cssClass}">
<c:if test="${currentPage gt 1}">
<!-- Links to previous page(s) -->
</c:if>
<span class="paginationCurrentPage">
Page ${currentPage}
[DEBUG: current=${currentPage},
total=${totalPages},
show=${currentPage lt totalPages}
inverse=${currentPage gt totalPages}]
</span>
<c:if test="${currentPage lt totalPages}">
<!-- Links to next page(s) -->
</c:if>
</span>
的问题是,链接,进入下一个页面无法显示的第一页(currentPage = 1
)之后的。转到上一页的链接在每个页面上都能正常工作。我也得到了一些真正怪异的输出从我的调试块:
[DEBUG: current=1, total=10, show=true inverse=false] //first page, correct
[DEBUG: current=2, total=10, show=false inverse=true] //second page; 2 > 10 == true? wtf???
[DEBUG: current=9, total=10, show=false inverse=true] //ninth page, still incorrect
[DEBUG: current=10, total=10, show=false inverse=false] //tenth page, correct
两个currentPage
和totalPages
是long
类型的请求属性,并通过申报标签属性传递给标签。那么,我做错了什么产生如2 > 10 == true
这样的疯狂输出?
更新
它正常工作,如果我用在比较文字10
更换totalPages
,但真的没有解决不了的问题。
回答你自己的问题的好工作。 –