Page-by-Page Iterator Pattern

hai,

i am a newbie to J2EE Pattern. i would like to know some examples about the Page - by - Page Iterator pattern. my requirement is to display results 10 by 10 in each page to the client by JSP. i am having nearly 10,000 results to display. how can i use Page - by - Page iterator concept to solve this problem?

thanks in advance.

sankarjune14

[377 byte] By [sankarjune14] at [2007-9-26 22:00:38]
# 1

I would look at building a Value List Handler object, based upon its named pattern. It is a class that holds an ArrayList of objects, stores an index/pointer to a current object, has methods for getting the current object, next n number of objects, and previous n number of objects, etc.

Then, you can use the object within a jsp session scope. The JSP, upon load, uses QueryString vars that tells the page, and thus the object, what to get (e.g. grab next n, grab previous n, get current n, etc.). Your back/foward URLs simply reload the same page but set the QueryString vars occordinlgy (e.g. fred.jsp?action=next&count=10, fred.jsp?action=prev&count=10, fred.jsp?action=first&display=10, etc.)

There is a good Value List Handler patern to start with in "CoreJ2EE Patterns", by Alur, Crupi & Malks (published by Sun).

bRi

BrianLedsworth at 2007-7-4 1:04:17 > top of Java-index,Other Topics,Patterns & OO Design...