Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes maintain checkbox status in pagination. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "maintain checkbox status in pagination." Watch "maintain checkbox status in pagination." New topic
Author

maintain checkbox status in pagination.

maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
i want to implement paging;results will come from DB;IN EVERY PAGE i should display 10 records;each record has checkbox;in the first page i checked 5 records and in the next page i checked another 5 records and i navigate between first page and second page the checked and unchecked results should be populated.how to maintain checkbox checked and unchecked status in pagination.
[ December 08, 2006: Message edited by: Bear Bibeault ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You would need to submit an HTTP form to move back and forth between the pages. The form post would contain the names of the checkboxes that were checked.
Before drawing the rows to the screen, you would need to match them up against the posted checkbox values to find out which ones need to be checked.

To draw an HTML checkbox with a check in it add the "checked" attribute:


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
how to maintain checked and unchecked results during pagination
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Ben Souther:
You would need to submit an HTTP form to move back and forth between the pages. The form post would contain the names of the checkboxes that were checked.
Before drawing the rows to the screen, you would need to match them up against the posted checkbox values to find out which ones need to be checked.

To draw an HTML checkbox with a check in it add the "checked" attribute:
maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
i asked you should i maintain in session??
 
Consider Paul's rocket mass heater.
 
subject: maintain checkbox status in pagination.