File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Persistence of checkbox states in cookie session using javascript in  JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Persistence of checkbox states in cookie session using javascript in  JSP page" Watch "Persistence of checkbox states in cookie session using javascript in  JSP page" New topic
Author

Persistence of checkbox states in cookie session using javascript in JSP page

Foni kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 54
Hi all,

I have check-boxes defined in my below function for my JSP page. Now the checkboxValue is the state of the check-boxes defined in the page. On-click of check-boxes the value is set to 'on' 1.e the check box is checked state. I want to save the "on" state of the check-boxes in a browser session or cookie session so that on page refresh the clicked checkboxstates should be maintained or present in the check state only for that session.

Can you please suggest me any approach to achieve this in my below code?

Foni kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 54
Bear Bibeault wrote:Nothing to do with JSP, moved to HTML/JavaScript.

Have you done a search on how to set cookies in JavaScript?


Hi Bear,

Ya I did but not get much idea or clarity for the approach to do this as I haven't implemented the cookie session concepts anytime in past. I was thinking to save the values of my check-box state in cookie and call them in the onbeforeunload event but unfortunately haven't used this function too before.

Can you please suggest some code snippets in this context that can help me? The change I want to do here is on page refresh the checkbox state(checked state) should be maintained even if we navigate to other page or refresh the browser in that particular browser session.

Would appreciate for your guidance in this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Persistence of checkbox states in cookie session using javascript in JSP page
 
Similar Threads
Display checkbox intially checked
Persist checked state of the checkbox
checkbox values in session
always get the value "20" no matter which checkbox I clicked
DisplayTag & Checkbox