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

From version 1.1
edited by smmccraw
on 2007/07/08 09:46
Change comment: There is no comment for this version
To version 5.1
edited by Pascal Robert
on 2010/09/19 10:26
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Programming__WebObjects-Web Applications-Development-Stateless Components
1 +Development-Stateless Components
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.smmccraw
1 +XWiki.probert
Content
... ... @@ -1,19 +1,17 @@
1 1  Implement [[isStateless>>http://developer.apple.com/documentation/WebObjects/Reference/API5.2.2/com/webobjects/appserver/WOComponent.html#isStateless()]] in your WOComponent and you will be able to manage the state yourself:
2 2  
3 -{{panel}}
3 +{{code}}
4 4  
5 - public boolean isStateless() {
6 - return true;
7 - }
5 +public boolean isStateless() {
6 + return true;
7 +}
8 8  
9 -{{/panel}}
9 +{{/code}}
10 10  
11 -=== Chuck Hill ===
11 +=== Chuck Hill ===
12 12  
13 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.
14 14  
15 -=== Jean-François Veillette ===
15 +=== Jean-François Veillette ===
16 16  
17 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.
18 -
19 -Category:WebObjects