Re: unable to set bindings on custom wocomponents
Re: unable to set bindings on custom wocomponents
- Subject: Re: unable to set bindings on custom wocomponents
- From: Arturo PĂ©rez <email@hidden>
- Date: Fri, 6 May 2005 21:16:58 -0400
Also, when you're editing a page with WOBuilder one can add a key to
the page (popup menu on the bottom, IIRC). That creates the local var
or methods one would need for a binding.
-arturo
On May 6, 2005, at 8:54 PM, Mark Morris wrote:
Hi Will,
In that case, this is the error you would expect. You are passing in
a value to the WOComponent via the binding, and it's trying to set
that value somewhere, but you don't have anywhere for it to be set.
This is fundamental to the way WebObjects works, and applies to all WO
components (with bindings), such as WOStrings, WOImages, forms, and
reusable components.
As the component is evaluated, the bindings are used to determine the
name of the variable or method to call to either evaluate or set the
value for the binding. The java class is the repository or conduit
for any values you need to use. (Actually, there's a way to turn this
off and get binding values manually, but I don't think that's what
you're trying to do here.)
The short answer is that you need to add something like a "public
String title" instance variable in your PageWrapper class, then use
that same variable (via a binding) when setting the page's title (via
WOString or whatever).
There's a lot going on here, and a lot to potentially take advantage
of, but in the normal usage it's very easy and straightforward. Let
me know if you have any other questions.
Regards,
Mark
On May 6, 2005, at 5:07 PM, Will Norris wrote:
no, there is no instance variable, only a binding.
On 5/6/05, Mark Morris <email@hidden> wrote:
Just to make sure, you never verified that you have an instance
variable or methods in the PageWrapper component that correspond to
"title". (This is the error that you would get if there isn't one.)
On May 6, 2005, at 3:56 PM, Will Norris wrote:
I have a custom component "PageWrapper" that has a number of
bindings,
including one called "title". I fire up my Main component in
WOBuilder, add PageWrapper as a custom component, and have all of
the
bindings for that component available. I set a value for the
"title"
binding. However, whenever I run the application, I get the
following
error..
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
[ takeValueForKey()]: attempt to assign value to unknown key:
'title'.
This WOComponent does not have an instance variable of the name
title
or _title, nor a method of the name setTitle or _setTitle
It's like it isn't seeing the binding at runtime. Any ideas? I've
been having a number of other problems getting WOProject to work
with
Tiger, so I'm not sure if it is a WebObjects problem or WOProject
problem. I'm using WO5.2.4.
Thanks,
Will
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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