Displaying limited number of records in jsp
Ii have a txt file which contains 2000 rows of data. I want to retrive this data and dispaly in a table form, but i want show some 20-30 records per page and rest 开发者_开发知识库numbering the pages like in google.
How do you achieve this in jsp.
After reading the article linked by Jon, you can use Displaytag which has built-int paging functionality
You need to look into pagination using JSP, there's a tutorial that I found from this great search engine called Google:
http://www.javaworld.com/javaworld/jw-07-2004/jw-0726-pagination.html
It will talk you through the process.
This question is asked a few several times before here. Just checkout under each the tags pagination
+ jsp
. I've answered this topic: ResultSet to Pagination. You may find it useful as well.
DisplayTag is another alternative, but it is not memory efficient as it caches all the rows in Java's memory, which might blow if you have thousands of rows and/or thousands of concurrent users. In such case better go ahead with DAO/database-level pagination, as outlined in my answer in the linked topic.
精彩评论