We are getting 1000 of records from services we need to display all records in jsp page. We have set the data to object and stored in java collections. How can get that collections in j开发者_StackOverflow社区ava script using Ajax and need to display 10 records in every time based on scroll we can load another 10 records upto completion. Please suggest the compatible technology. At this time We are using the struts2 and jquery.
It sounds like you want something along the lines of SlickGrid. It is very fast, and is the data grid that powers SEDE result tables.
Another option, which I have used before with great results, is a YUI DataTable with pagination (server-side or client-side). With client-side pagination — which is typically faster, since all the data is already in the browser — I've created YUI data tables that work with more data than the browser can parse at once, with minimal performance degradation.
- You can try implementing a simple pagination technique
int totalRecords; int maxRecordsPerPage; int totalPages = ( totalRecords / maxRecordsPerPage ); int displayRecordFrom; int displayRecordTo;
Total Records : Number of records fetched.
Max Records Per page :
Total Pages : this is optional, either you can display total pages some thing like google or just put next button or link
Display Record From And To : As you are storing records in collection, it can be fetched used get(index)
After fetching results use Jettison or any other Java JSON library to output results into JSON. Instead of working from scratch, Its better to use pre-tested third party Javascript components using JQuery or other library.
精彩评论