rajesh
rajesh

Reputation:

Displaying huge arraylist in jsp

I have 15000 records in an arraylist each record size is around 2MB. I have display this list on a jsp page in the most efficient manner.

Please suggest the best method to do it.

I can not filter data on server side. User needs all records on jsp page at once.

Thanks in advance.

Upvotes: 0

Views: 2815

Answers (3)

flush() your response writer regularily to send data to the client.

Ensure that you do not use mile-high tables or similar which requires the browser to deal with many objects in order to be able to do layout.

Tell user to use a modern browser. I belive Opera does well with these kind of pages.

Upvotes: 0

Stephen C
Stephen C

Reputation: 718778

The straightforward answer is that you cannot render 15,000 * 2Mb records in a simple JSP. That amounts to a 30Gb web page (+ formatting) which would have to be rendered by the server transmitted to the browser, and then buffered and displayed by the browser. That simply will not work. For a start, your users' machines won't have 30Gb of RAM.

So that means that you are going to have to implement a more complicated solution in which you provide the user with some kind of table or list viewer that allows the user to page or scroll through the 15,000 records without sending the whole lot to the user's browser. The old-school approach is to implement the list view / scrolling logic and rendering on the server side. The Web 2.0 way is to use some Javascript toolkit to implement the display and scrolling on the client side, using AJAX calls to fetch records from the server as the user looks at them.

Upvotes: 7

Daff
Daff

Reputation: 44205

I don't know if there is a really performant way for displaying that many records but you may have a list at the jQuery Grid (the Demo page has an example under Advance/Search big sets for displaying and searchign 12000 records). Alternatively any other JavaScript Grid like the one from ExtJS may be helpful.

Upvotes: 0

Related Questions