Is it possible to have the previous value of checkbox along with new value?
My problem is, I have to execute some code, only if the value of checkbox is true, also if it was already true, then I am not suppose to perform the same action again. Currently what I am doing is , for every checkbox I am having previous value holder too. If the value is changed only then I perform the action ( and it is true ), and set value of previous value holder to the new value.
programmatically create a spring context
Spring Injecting into Struts RequestProcessor
Spring Open JPA
When the checkbox changes the state, you can directly call your special code..
What is the simplest solution to integrate 2 apps within a Tomcat server?
Or when you have a preference page, in which the checkbox is inside, you have to store the state of the preference page and check, if you have changed states inside..
netbeans and Apache Derby Embedded + spring
Does Spring-MVC annotation based bean validation support for collection-based property ? (Spring-MVC)
Spring 2 Hibernate Annotation
Two approaches of task distribution in a multi tier application
Spring does this to help determine whether the checkbox was unchecked or just not submitted.. You should be able to appropriate this hidden field for your purposes, i.e.
you can check for the value of the hidden field and compare it to the actual checkbox field value.. See Spring MVC 2.5 Checkbox tag.
You will need to save the old value somewhere before the bind phase begins.
. To do this, in the formBackingObject method (which gets called again after a POST submit), put a copy of the value in the request object.
Then in the onSubmit method, you can retrieve the value from the request for the comparison.
You could also record it in a different field on the command.. I find this SimpleFormController cheat sheet very helpful for figuring out the execution order of the methods.
It should help you out here too..