Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 26th, 2008, 03:34 PM
Registered User
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pagination with checkboxes

I have a checkbox field as one of the columns. I have pagination in the page.

The problem i have is, i will loose the status of the checkbox when i go to second page. If i select some of the checkboxes in page 1 and go to page 2 to select some more and if i come back, i loose all the selected checkboxes in page 1.

Is there a way where i could save my check boxes in session and its checked while i browse across pages and gets submitted all at once.


Old November 26th, 2008, 11:48 PM
Registered User
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

hey, did u get a solution to this problem? it is currently my problem, i dont know how to retain the values of the checkboxes when they are checked, and how to pass all the selected checkboxes when submitted. thanks!
Old November 28th, 2008, 12:48 AM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

Lots of ways to do this.

You could, indeed, save the list of checked checkboxes in a session variable.

But you could also just store them in hidden form fields.

Remember, an UNCHECKED checkbox has NO VALUE AT ALL when you get to the page that processes it (that's the nature of HTML...nothing to do with JSP). So any checkboxes that *do* have *ANY* value must have been checked. Which makes finding them and storing a list of them into a single string (and then storing that string into a session variable or into a hidden form field) very easy to do.

If you NEED the *values* of all the checkboxes, as well as whether or not they were checked, then likely the easiest thing to do is just create a hidden form field for each one, giving it the same name and value as the checked checkbox you found.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Regarding Pagination!!!!!!!!!!! mohit_malik555 Pro Java 2 August 3rd, 2006 08:06 AM
pagination Regornil Pro JSP 2 May 31st, 2005 06:10 AM
Pagination error lily611 General .NET 2 October 17th, 2004 11:28 PM
Please.....Pagination junemo PHP Databases 2 September 25th, 2004 01:14 PM
pagination junemo Oracle 0 July 1st, 2004 04:07 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.