Re: simple question
Re: simple question
- Subject: Re: simple question
- From: Michael Engelhart <email@hidden>
- Date: Sun, 25 Sep 2005 12:07:59 -0500
Thanks helge -
I've tried your suggestions and still get the same error. The
problem is that WebObjects isn't finding the instance variable for
some reason but it's finding the component??!
Mike
On 9/25/05, Helge Staedtler <email@hidden> wrote:
> hi.
>
> your method for reading the var should usually be named
>
> public String queryString() {
> return queryString;
> }
>
> instead of
>
> public String getQueryString() {
> return queryString;
> }
>
> this is widespread convention in webobjects-apps.
>
> you can also try to eliminate these methods completely and make the var
> "queryString" public. this should work immediately!
>
> so define e.g. the var as follows:
>
> public String queryString = null;
>
> regards,
> helge
>
>
>
>
> Am 25.09.2005 16:12 Uhr schrieb "Michael Engelhart" unter
> <email@hidden>:
>
> > Hi -
> >
> > I'm sorry to bug everyone with this probably dumb question but I'm not
> > sure what I'm doing wrong. I have Tiger running with WO 5.3 and
> > XCode 2.1. I've tried deleting my build directory and rebuildilng
> > and running so I don't think the problem is a corrupted build
> > directory. I think I'm just forgetting some basic tenet of
> > WebObjects but I can't figure out what.
> >
> > So, I create a new project with a single component called
> > CitySearchForm which is defined in code like this:
> >
> > import com.webobjects.foundation.*;
> > import com.webobjects.appserver.*;
> > import com.webobjects.eocontrol.*;
> > import com.webobjects.eoaccess.*;
> >
> > public class CitySearchForm extends WOComponent {
> >
> > protected String queryString;
> >
> > public CitySearchForm(WOContext context) {
> > super(context);
> > }
> >
> > public String getQueryString() {
> > return queryString;
> > }
> >
> > public void setQueryString(String newQueryString) {
> > queryString = newQueryString;
> > }
> >
> > public WOComponent doCitySearch() {
> > System.out.println(queryString);
> > return null;
> > }
> >
> > }
> >
> > The .wod looks like this:
> > CITY_SEARCH_FORM: WOForm {
> > }
> >
> > CITY_SEARCH_SUBMIT_BUTTON: WOSubmitButton {
> > action = doCitySearch;
> > }
> >
> > QUERY_STRING_TEXT_FIELD: WOTextField {
> > value = queryString;
> > }
> >
> >
> > I then add this component to my Main.wo in WOBuilder using the add
> > Custom element menu selection. But now when I run the application I
> > get this error:
> >
> > Error: com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
> > [ valueForKey()]: lookup of unknown key: 'queryString'. This
> > WOComponent does not have an instance variable of the name queryString
> > or _queryString, nor a method of the name queryString, _queryString,
> > getQueryString, or _getQueryString
> >
> > Reason: [<com.webobjects.appserver.WOComponent name: CitySearchForm
> > subcomponents: null > valueForKey()]: lookup of unknown key:
> > 'queryString'. This WOComponent does not have an instance variable of
> > the name queryString or _queryString, nor a method of the name
> > queryString, _queryString, getQueryString, or _getQueryString
> >
> > Now I know I've been away from WO for a while but I know I've done
> > this before and it just worked out of the box. Did something change
> > in the 5.3 release or am I just forgetting some basic thing.
> >
> > Thanks for any help.
> >
> >
> > Mike
> > _______________________________________________
> > 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