Last modified by Pascal Robert on 2010/09/19 10:26

Hide last authors
Pascal Robert 6.1 1 Implement [[isStateless>>url:http://developer.apple.com/documentation/WebObjects/Reference/API5.2.2/com/webobjects/appserver/WOComponent.html#isStateless()||shape="rect"]] in your WOComponent and you will be able to manage the state yourself:
smmccraw 1.1 2
Quinton Dolan 3.1 3 {{code}}
smmccraw 1.1 4
Quinton Dolan 3.1 5 public boolean isStateless() {
6 return true;
7 }
smmccraw 1.1 8
Quinton Dolan 3.1 9 {{/code}}
smmccraw 1.1 10
Pascal Robert 4.1 11 === Chuck Hill ===
smmccraw 1.1 12
Pascal Robert 6.1 13 There is some fairly OK information on stateless and nonsynchronizing components in Practical WebObjects. In a nutshell you need to use valueForBinding/setValueForBinding to access bound values and implement a public void reset() method that nulls all instance variables. This often requires design changes to your component.
smmccraw 1.1 14
Pascal Robert 4.1 15 === Jean-François Veillette ===
smmccraw 1.1 16
Pascal Robert 6.1 17 Sometimes for stateless component, you need to keep variables values between the 3 phases, from takeValueFromRequest all the way to appendToResponse. Since ivars in a stateless component can't handle this case (reset() will be called after each phase), you have to store the information somewhere. Just use context.userInfo dictionary, and put whatever value in there. As the name imply, the value will only be good for this request only.