Re: RE Little starter help with instance and action of a WOConponent
Re: RE Little starter help with instance and action of a WOConponent
- Subject: Re: RE Little starter help with instance and action of a WOConponent
- From: email@hidden
- Date: Sat, 19 Aug 2006 10:11:33 +0200
Hello John,
I didn't make the mistake, I just tried
to help Richard.
I through we HAVE TO provide getter
and setter (taht's what I do in ALL my components) and I through it was
the problem.
Finally, Richard find that his problem
came from target and I've learned what you did resume well :
- "KeyValueCoding
will search for public fields, then public accessor methods, then protected
fields, then protected accessor methods. After this point, it will
throw the exception."
I didn't really help Richard but I've
tried.
To answer your question, I use XCode...
blame on me but it's really easier to use, even if I miss hot compilation
and package organisation (but that's another story...).
Jérémy
John Larson <email@hidden>
19/08/2006 04:05
|
A
| email@hidden
|
cc
| webobjects-dev <email@hidden>
|
Objet
| Re: RE Little starter help with instance
and action of a WOConponent |
|
Jeremy,
This thread should restart here. To remove any potential
for error, redifine your aPerson field public and try again. If this
doesn't work, then please post the code for the field. KeyValueCoding
will search for public fields, then public accessor methods, then protected
fields, then protected accessor methods. After this point, it will
throw the exception. It is a misconception that you have to have
accessor methods (get and set). They can help make your code easier
to read, but they will not cause these problems.
There are many places this can go wrong. Let's begin
by looking at the source java for Main. As Paul says later, one area
could be the wrong target. Are you using Eclipse or XCode?
John
On Aug 18, 2006, at 10:42 AM, email@hidden
wrote:
It seems that you did forget the getters and setters that need public acces.
Jérémy
Hello,
I have been away from WO for sometime and I picked it up again today.
I am having a problem that any instance variable or method I add using
WOBuilder to my Main component can not be found during runtime, but I
see the method and instance code add to main.java
Here is the errors I am getting
For a instance variable
--------------------------------------------------------
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException: [
valueForKey()]: lookup of unknown key: 'aPerson'. This WOComponent does
not have an instance variable of the name aPerson or _aPerson, nor a
method of the name aPerson, _aPerson, getAPerson, or _getAPerson
Reason:
[<Main name: Main subcomponents: null > valueForKey()]: lookup of
unknown key: 'aPerson'. This WOComponent does not have an instance
variable of the name aPerson or _aPerson, nor a method of the name
aPerson, _aPerson, getAPerson, or _getAPerson
------------------------------------------------------------------------------------------
or if I do not used the instance variable in the Main component and just
have a form with a addPerson action I get :
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException: [
valueForKey()]: lookup of unknown key: 'addPerson'. This WOComponent
does not have an instance variable of the name addPerson or _addPerson,
nor a method of the name addPerson, _addPerson, getAddPerson, or
_getAddPerson
Reason:
[<Main name: Main subcomponents: null > valueForKey()]: lookup of
unknown key: 'addPerson'. This WOComponent does not have an instance
variable of the name addPerson or _addPerson, nor a method of the name
addPerson, _addPerson, getAddPerson, or _getAddPerson
my main.java code
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class Main extends WOComponent {
public Person aPerson;
public Main(WOContext context) {
super(context);
//aPerson = new Person();
}
public WOComponent addPerson()
{
//aPerson = new Person();
return null;
}
}
Any ideas…..
Thank you,
Richard Whittaker
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
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
_______________________________________________
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