I am trying to use a check box to print yes or no on another page. So far when the user clicks on the check box it will print yes on the next page and if it is not checked then it will print no. but when you return to go update the information, the check box is no longer checked even if it is set to yes. how to i maintain the checked status when updating?
I am using struts2 for my checkbox:
first jsp page:
listing the outcome on second jsp page:
i've tried if statements around the checkbox but nothing I am doing is working correctly. can anyone point me in the right direction or give me something to read up on so I can figure this problem out.
how to i maintain the checked status when updating?
I don't know much about struts2 but what happens is that you need to record the value of the checkbox either in session or table(or hidden field) once in second page so that when you return back to the first page you apply the ?: operator in the value attribute of your checkbox which should be equal to true(checked) or false(not checked) i.e <s:checkbox ... value="(condition)?true:false"/> where condition is a test on the previously saved value of the checkbox.
I am always surprised at the added knowledge i can get from others when i give my opinion on a topic.
subject: Best way to maintain checkbox status while switching between pages