Last modified on 11 May 2009, at 20:59

WebObjects/Web Applications/Development/Stateless Components

Implement isStateless in your WOComponent and you will be able to manage the state yourself:

 public boolean isStateless() {
   return true;
 } 

Chuck HillEdit

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.

Jean-François VeilletteEdit

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.