< WebObjects < Web Applications < Development

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

 public boolean isStateless() {
   return true;
 } 

Chuck Hill

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 Veillette

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.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.