Re: Problem passing strings to my wrapper component
Re: Problem passing strings to my wrapper component
- Subject: Re: Problem passing strings to my wrapper component
- From: "Daniele Corti" <email@hidden>
- Date: Fri, 23 Feb 2007 09:29:23 +0100
2007/2/23, Kevin Windham <email@hidden>:
I have a page wrapper and I've set up an API for it so I can pass
some variables to it from the pages containing content. I have
managed to pass Boolean values without any problem. In my .java file
I put
public Boolean boolValue;
And in the API for the wrapper I have the name boolValue and value
set is Boolean.
This works fine, I can inspect the wrapper in my content page and set
the boolValue to true and my wrapper page responds appropriately.
However, if I do the same thing with a string, I get a null pointer
exception. The only difference I can see is there is no option for
String in the value set menu, so I just leave that unset. I imagine I
am missing something, but I can't seem to find any leads on what it is.
That's strange, maybe try to create two methods for set and get the string:
String myString;
public String myString()
{
return myString;
}
public void setMyString(String newString)
{
myString = newString;
}
now you bind your wrapper to myString, and it will call the two methods!
Maybe the difference is that I am trying to access the string in
my .java file. I simply put in some code in the constructor, but
maybe the string hasn't been set yet by the content page.
well that's because the constructor is called just one time: after the first initialization the component is kept in cache by the app, or the session, I don't remember... then the component is just awaked.
You must override
public void awake()
{
//put here the code you want to be executed at the beginning of request-response loop
}
or at the end of the loop:
public void sleep()
{
}
or append to the response
public void appendToResponse(WOResponse r, WOContext c)
{
//your code before append the component
super.appendToResponse(r,c);
//your code after appended the component
}
Is there
any documentation on the chain of events for this scenario?
Thanks,
Kevin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden
This email sent to email@hidden
--
Daniele Corti
AIM: S0CR4TE5
Messenger:
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