Re: WOSwitchComponent Problem
Re: WOSwitchComponent Problem
- Subject: Re: WOSwitchComponent Problem
- From: Andrew Lindesay <email@hidden>
- Date: Wed, 7 Mar 2007 08:48:46 +1300
Hello Thierry;
Actually the problem is, that WebObjects seems to hold objects
somewhere in
memory and then get's them back when I open the window again...
Somehow.
It is a little hard to understand without seeing the project, but if
your components are in the WOSwitchComponent then they are treated as
being stateless. Maybe a good approach here is to not store data in
your component's instance variables and instead to get the data
straight out of the bindings. People sometimes use a pattern like this;
public class SomeComponent extends WOComponent
{
protected String someString = null;
....
public boolean synchronizesVariablesWithBindings() { return false; }
public boolean isStateless() { return true; }
...
public String getSomeString()
{
if(null==someString)
someString = (String) valueForBinding("someString");
// maybe do some checks here?
return someString;
}
public void reset()
{
super.reset();
someString = null;
}
}
Have a look at the javadoc for information about "reset(..)",
"synchronizesVariablesWithBindings(..)" and "isStateless(..)".
cheers.
___
Andrew Lindesay
www.lindesay.co.nz
_______________________________________________
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