AlaNio
02-13-2007, 01:02 PM
Hi, im going to be returning a list from a database, and i was wondering how i would go about writing code to make it show say 10 items a page if it's possible in JSP.
|
Click to See Complete Forum and Search --> : JSP : Items per page AlaNio 02-13-2007, 01:02 PM Hi, im going to be returning a list from a database, and i was wondering how i would go about writing code to make it show say 10 items a page if it's possible in JSP. potterd64 02-21-2007, 07:50 PM if you want 10 items per page then keep a counter that you increment every time you print out an item from the list. Once you get to 10, stop printing. You'll know how many pages the list will take up by calculating: ceiling(numResults/10) Make it so that when a user goes to page X, the list items that are displayed are (X*10) to (X*10 + 9). That way page 0 will display items 0 to 9, page 1 will display items 10 to 19, page 2 will display items 20 to 29, etc. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |