views:

196

answers:

1

I am using displaytag 1.0 in my Struts base application. I have 5 million rows to showing reports of all rows data by paging with 50 records. It takes 5 minutes to rendering the data. Can we reduce this one? Please suggest how make it with in one minutes.

A: 

It is apprently hauling the complete database into Java's memory instead of only the data of interest (the current page). You'll need to introduce request-based pagination at the DAO level.

To start, in your DAO class do a SELECT stuff FROM data LIMIT firstrow OFFSET rowcount or something like that depending on the DB used. Then in your JSP create a HTML table yourself with help of JSTL c:forEach or Struts' logic:iterate. Keep one or two request parameters in the background in a input type="hidden" element: the first row to be displayed (firstrow) and eventually the amount of rows to be displayed at once (rowcount). Finally provide a bunch of buttons which instructs the server side code to in/decrement the firstrow with rowcount everytime. Just do the math.

You can find a more detailed answer here.

BalusC