I am facing a situation where i need to get states of non checked checkboxes besides checked one, as in my db all non checked will be stored as 'N' and all checked as 'Y'. Considering the fact that user can anytime make a checkbox state from on to off . I need to capture and update the db accordingly , any help would be highly solicited.
Thanks & regards,
When u do a request.getParameter("checkbox name") and get a String which corresponding to the value of the checkbox u know it is checked.
And if u get null u know it is not checked.
But That would be good only in cases where you know before hand , how many checkboxes are there and what are there names, Imagine a scenario where the name is a same its a checkbox group and you do not know how many checkboxes are there as say they are populated from a database. In that case you can never be sure.
This is obviously a case for storing information in the session as the page is being generated, possibly as an ArrayList or String
That way when you are processing the form data you will have a list of all checkboxes.