A "get..." gotcha!
A "get..." gotcha!
- Subject: A "get..." gotcha!
- From: Simon McLean <email@hidden>
- Date: Thu, 30 Apr 2009 20:19:15 +0100
hopefully this post will avoid someone else wasting needless hours ...
we use the "get" and "set" convention across all of our projects.
Today I put together the classic way of handling checkboxes in an
WORepetition using the following "get" and "set" methods:
public boolean getGroupSelected() {
return selectedEmployeeGroups.contains(anEmployeeGroup);
}
public void setGroupSelected(boolean b) {
if (b) {
if (!selectedEmployeeGroups.containsObject(anEmployeeGroup)) {
selectedEmployeeGroups.addObject(anEmployeeGroup);
}
} else if (selectedEmployeeGroups.containsObject(anEmployeeGroup)) {
selectedEmployeeGroups.removeObject(anEmployeeGroup);
}
}
I then binded up my checkbox like this:
<wo:checkbox checked = "$getGroupSelected"/>
However, when the code runs WO was giving me the classic exception
"the component [insert component name] does not have a method with the
name getGroupSelected .... blah blah blah"
So, you check your class, check your bindings and begin to bang your
head on the desk shouting "yes it f$!&% well does !!!"
Anyway, change the component binding to this:
<wo:checkbox checked = "$groupSelected"/>
and WO is happy again.
I think what is happening is that during the RR loop WO looks for
"setGetGroupSelected" rather than plain "setGroupSelected" and hence
decides it's not going to play game.
Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden