How to perform pagination in jsp

两盒软妹~` 提交于 2019-12-02 02:26:06

The Display Tag library is an open source library which provides pagination functionality while still being easy to use.

You can set your records in request scope from your servlet class.

request.setAttribute( "test", new TestList(10, false) );

and Then you can use display tag library to display it with pagination.

<%@taglib uri="http://displaytag.sf.net" prefix="display" %>


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

You can find it's basic tutorials here.


Updated:

You need not to use <table>, <tr>, <td> tag only <display:table> and <display:column> is enough. You can directly use fields from EmpList inside property tag of <display:column>.

Follow this tutorial.

You can you the Display tag library. It provides paging capability for your JSP page. You just need to pass a list of objects to this taglib and it will add pagination to your page. It also support other functionality such as sorting, grouping, export, etc.

I am using Display Tag Library and it does everything by fly. Just pass the list into the display:table property and display tag will take care of the rest. You can also use EL with it. It is easy to use and also maintainable.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!