example-subsets.jsp

来自「一个比较不错的java分页标签,有源代码,开发者 可以学习学习」· JSP 代码 · 共 48 行

JSP
48
字号
<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:display="urn:jsptld:http://displaytag.sf.net">
  <jsp:directive.page contentType="text/html; charset=UTF-8" />
  <jsp:directive.page import="org.displaytag.sample.*" />
  <jsp:include page="inc/header.jsp" flush="true" />

  <jsp:scriptlet> request.setAttribute( "test", new TestList(10, false) ); </jsp:scriptlet>

  <h2>Showing subsets of data from the List</h2>

  <h3>Complete List</h3>

  <display:table name="test">
    <display:column property="id" title="ID" />
    <display:column property="email" />
    <display:column property="status" />
  </display:table>


  <h3>First 5 Items</h3>

  <display:table name="test" length="5">
    <display:column property="id" title="ID" />
    <display:column property="email" />
    <display:column property="status" />
  </display:table>


  <h3>Items 3-8</h3>

  <display:table name="test" offset="3" length="5">
    <display:column property="id" title="ID" />
    <display:column property="email" />
    <display:column property="status" />
  </display:table>



  <p>Let's say that you have a list that contains 300 elements, but you only want to show the first 10, or for some
  reason you want to show elements 101-120 (Yes, I know what you really want is to be able to page through them - be
  patient that example is coming up).</p>

  <p>You can use the <code>length</code> and <code>offset</code> attributes to limit the display to only portions of
  your List.</p>

  <jsp:include page="inc/footer.jsp" flush="true" />

</jsp:root>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?