Hello Richard,

WO components can access instance variables just as well as set/get methods, so that's not the issue.  (They don't even need to be public.)  Perhaps your Main.java has the wrong target, or some other similar scenario.  Because although you are seeing them in the source code, they're not ending up in the final, built class.

Regards,
Mark

On Aug 18, 2006, at 10:58 AM, [EMAIL PROTECTED] wrote:


It's the problem. WebObjects don't acces directly the instance variable but the getter and setter methods. Just look at the error message that explains you webobjects try to find the right method .

> not have an instance variable of the name aPerson or _aPerson, nor a
> method of the name aPerson, _aPerson, getAPerson, or _getAPerson


So add the methods setAPersonn() and getAPerson() (or aPersonn() if you rather like).

Jérémy



Webobjects <[EMAIL PROTECTED]>

18/08/2006 17:34

A
webobjects-dev <[email protected]>
cc
[EMAIL PROTECTED]
Objet
Re: RE Little starter help with instance and action of a WOConponent





Hello,


The instance variable in Main.java aPerson is has access level of pubilc
and the method addPerson is also public.
The class Person is a public also, so think this may not be the problem.

Richard

On Aug 18, 2006 11:42 AM, [EMAIL PROTECTED] wrote:

> It seems that you did forget the getters and setters that need public
> acces.
>
> Jérémy
>
>
>
>
> Webobjects <[EMAIL PROTECTED]>
> Envoyé par : [EMAIL PROTECTED]
> 18/08/2006 16:51
>
> A
> [EMAIL PROTECTED]
> cc
>
> Objet
> Little starter help with instance and action of a WOConponent
>
>
>
>
>
>
> 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 PROTECTED]
> 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 protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to