Hi :
Use the displaytag Taglib from
displaytag.sourceforge.net/ It has all you need and much more.
This is an example of using it - after you have got the JAR File and all
<!-- Tag Lib directive -->
where
requestScope.billItemsList is a MAP-List-primitive array of beans etc and has been put in the requestScope.
It will give you not only pagination that you are looking at but also automatic sorting, downloading - as CSV, pdf, EXCEL, html - and many more things you can explore from the Website.
Chetan