0

Prev 1-10 Next、などのページネーション リンクが必要Prev 11-20 Nextです。arList という配列リストがあり、300 レコードを保持しています。最初の 10 レコードを最初に表示する必要があります。次だけをクリックしながら、次の 10 を表示する必要があります。

リンクやリソースを共有できる人はいますか?

ArrayList arList  = new ArrayList();
arList = // calling method to retrieve elements

// table starts here
<table id="tbl">


 for(int i=0; i < arList.size();i++) 
 {
 HashMap hMap=(HashMap)arList.get(i);                        
 firstVal= (String)hMap.get("first");
 secondVal= (String)hMap.get("second");
%><tr><td> 
// firstVal and secondVal goes here
</tr></td><%
 }

</table>
4

1 に答える 1

1

これにはJSTLを使用できます!!

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
<c:forEach items="${list}" var="item" begin="0" end="9">
    ${item}
</c:forEach>

これらの属性で EL を使用することもできます。

request.setAttribute("firstrow", 0);
request.setAttribute("rowcount", 10)

<c:forEach items="${list}" var="item" begin="${firstrow}" end="${firstrow + rowcount - 1}">
    ${item}
</c:forEach>
于 2013-03-27T05:59:42.823 に答える