This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, i've a problem with the tag html:checkbox. With other tags (html:text) i try this and it's ok. I put one checkbox in a logic:iterate, and its prints me the data from the BBDD, but the problem is when i unckecked some checkbox and submit() the form, in the Form in Action(ActuMedioambiental.saveTareas()) not appears the new value... but if i check and unchecked checkbox the value in the Action is the correct.
This problem is due to an odd behavior of the HTML for checkboxes. If a checkbox is unchecked, no parameter is sent to the server, and hence, no setter is called in the Struts ActionForm. To get around this problem, you must override the reset method in your ActionForm, and in that method, set the value of each property associated with a checkbox to its unchecked value. Since struts calls the reset method before it calls the setters, any checkboxes that are checked will cause the setters to override the values set in the reset method. Here's an example:
I have seen you use the @Override before re-defining the public void reset() method. Is that necessary? I don't have that when I override the reset() method. Thanks!
The worst thing with having everything is finding a place in the garage to keep it.
Joined: Feb 15, 2005
@Override is a java 1.5 annotation, so it only works if your development environment and your App Server supports Java SE 1.5. It's entirely optional, but I like it and have started using it because it gives me an added level of error checking. If I get one of the parameters wrong on the method, the compiler will tell me "Hey, you said you were overriding a method, but there's no method in any of your superclasses that matches that signature."
It also makes for good documentation. When looking at a class, it's very helpful to know which methods are overriding superclass methods. [ March 01, 2007: Message edited by: Merrill Higginson ]