• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Object property initialization problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object property initialization problem


  • Subject: Re: Object property initialization problem
  • From: Arturo Perez <email@hidden>
  • Date: Tue, 20 Apr 2004 18:13:38 -0400

Randall Perry wrote:
Got a Direct Action that calls a component page, ResultPage, passing it a
EOGenericRecord object, CustView, that's populated with data.

Is CustView a class or an instance? BTW, what platform are you developing on? How is that object being passed to/through the DA?



Am able to access properties of the CustView object in the component (via .wod file). But need to access a property of the object in a method in ResultPage.java.

Well, you could do it the same way WO does (the way the component does):

  (whatever your EOGenericRecord is called).valueForKeyPath("userName");


So, tried to access it and got 'Cannot resolve symbol' error. Thought ok, so I need to create a dummy instance of the class object because the compiler doesn't know it's going to be set by the Direct Action, so I created it.

    public CustView custInfo = new CustView();
    String custDir = "/Users" + custInfo.userName;

That's not going to work unless the userName property is a public ivar. Bad practice to make it a public ivar but you're welcome to do whatever you like :-)



Then I got the same error trying to access the object property 'userName'. So tried initializing userName to an empty string but couldn't find a way to do it without error:

    public CustView custInfo = new CustView();
    custInfo.setUserName("");

2nd line above generates error "<identifier> expected"

Sounds like your class doesn't have the methods you think it has. CustView is a subclass of EOGenericRecord? Then you can use
valueForKey/takeValueForKey.


-arturo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Object property initialization problem
      • From: Randall Perry <email@hidden>
References: 
 >Object property initialization problem (From: Randall Perry <email@hidden>)

  • Prev by Date: Object property initialization problem
  • Next by Date: Re: Object property initialization problem
  • Previous by thread: Object property initialization problem
  • Next by thread: Re: Object property initialization problem
  • Index(es):
    • Date
    • Thread