This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

maintain checkbox status while doing pagination

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my problem is to maintain checkbox status while doing pagination.



first time when jsp page loads it will display first 20 records with selected checkboxes with next button.

in the first page when u uncheck some of the records and click next page it goes to second page and again clicks prev button comes to first page checks some more records clicks to next button it goes to 2nd page. if u to first page checked records are coming.
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about something like this in your JSP:

<c:choose>
<c:when test="${params.test == 'yes'}">
<input name="test" type="checkbox" value="yes" checked />
</c:when>
<c therwise>
<input name="test" type="checkbox" value="yes"/>
</c therwise>
</c:choose>
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniel Rhoades:
How about something like this in your JSP:

<c:choose>
<c:when test="${params.test == 'yes'}">
<input name="test" type="checkbox" value="yes" checked />
</c:when>
<c therwise>
<input name="test" type="checkbox" value="yes"/>
</c therwise>
</c:choose>





when the page loads i am able to display records with selected checkboxes.

I have a checkbox field as one of the columns. I have a submit button in a page which will save checkbox status into the database. I also have pagination.

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
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could save all the checkbox statuses in a Map (updating them per request if necessary) using the name attribute as the key and the value attribute as the value, then in the JSP you could loop through the Map checking each checkbox's status.
reply
    Bookmark Topic Watch Topic
  • New Topic