PAGING in JSP: "To make it simple, you will need implement (3 parts described below will be there in one form or another, can't be simpler that this):
1. Jsp page that know how to display list of given data (current page, total number of items are good to have as well).
This is simple task.
2. Controller (servlet , jsp) that knows what to do (how to calculate page number) once navigation request comes.
This is good exersise in math and logic . After couple hours pretty much anyone would get it work.
3. Data provider (java code) that provides subset of data required to be displayed on requested page. The MAIN IDEA here to limit data set only to those 15 or so records you want to diplay on page.
Simple task as well. Anyway here is demo class test.RunThisOne that demonstrates usage of data provider. Class test.FakeContentGenerator is immulation of data result set. Go ahead and change implementation to retrieve the data from DB. For DB provider real trick would be to limit result set by means of SQL, ROWNUM should do the trick for Oracle (do not remeber exact syntax though)
Something like
select * from ABC
where A = B and
ROWNUM > startIndex and
ROWNUM < endindex
To run example unzip attached file and start runit.cmd script."
Wednesday, February 23, 2005
Nazeer Logs
Previous Posts
- Gmail Agent API - Mail Notifier - Address Book Imp...
- Articles: "The Best Java Open-Source Tools Date: N...
- JUnitEE: " you have tried to use JUnit with a J2EE...
- Artima SuiteRunner Project: "Artima SuiteRunner Pr...
- JUnit Primer:This article demonstrates how to writ...
- CVS tutorial: "Quick CVS tutorial "
- Good Site Hajj and `Umrah
- The Hajj at a Glance
- Raleigh City/County Bureau of Identification
- IBM UpdateInstaller for WebSphere Application Serv...
Subscribe to
Posts [Atom]

<< Home