State Managed By

Sets the value of the <$cmpStatemanagedBy> constant, which specifies the mechanism used to save state information for the component.

Value

Description

0 (None)

State management is not required, or will be implemented using a mechanism other than cookies or a state management component. For more information, see State Management Mechanisms.

1 (Cookie)

Use cookies to store state.

Cookies are sent to the client browser. By reading the cookies, you can get the actual state information that was sent to the client browser by a previous request.

2 (State Management Component)

Use a separate component to manage state.

Parameters are passed to a component operation that is responsible for maintaining state. For server pages, this is Uniface’s state manager component (USYSSTAT).

Description

The <$cmpStatemanagedBy> constant is used in the predefined code of preActivate and postActivate triggers of dynamic and static server pages.

Predefined Code in Server Pages

State Managed by Cookie

If State Managed By is set to 1 (Cookie), the pre-defined code in the preActivate and postActivate triggers results in the following runtime code:

preActivate

trigger preActivate
variables  
string WebServerContext, Cookie, Session, UserContext
endvariables
   getitem/id Cookie, $webinfo("COOKIESIN"), "MY_VARLIST_COOKIE"
   getlistitems/id /component Cookie
end; preActivate

postActivate

trigger postActivate
variables  string WebServerCntxt, SessionId, Varlist
endvariables  
   Varlist = $componentinfo($componentname, "VARIABLES")  
   putlistitems/id /component Varlist  
   putitem/id $webinfo("COOKIESOUT"), "MY_VARLIST_COOKIE", Varlist
end postActivate
State Management Component

If State Managed By is set to 2 (State Management Component), the pre-defined code in the preActivate and postActivate triggers results in the following runtime code:

preActivate

trigger preActivate
variables  
   string WebServerContext, Cookie, Session, UserContext
endvariables
   WebServerContext = $webinfo("WEBSERVERCONTEXT")  
   getitem/id Session, WebServerContext, "SESSION"  
   UserContext = ""  
   activate "USYSSTAT".GetState(Session, $instancename, UserContext)  
   getlistitems/id /component UserContext
end; preActivate

postActivate

trigger postActivate
variables  
string WebServerCntxt, SessionId, Varlist
endvariables
   WebServerCntxt = $webinfo("WEBSERVERCONTEXT")  
   getitem/id SessionId, WebServerCntxt, "SESSION"  
   Varlist = $componentinfo($componentname, "VARIABLES")  
   putlistitems/id /component Varlist  
   activate "USYSSTAT".SetState(SessionId, $instancename, Varlist)
end; postActivate

Related Topics