SetServerSideState method (DataWindows)
Description
Tells the server component whether to attempt to maintain
its state by saving the retrieved data and leaving the transaction
open. Keeping the retrieved data means that the component does not
need to reconnect and retrieve data every time a method is called.
When the Web DataWindow is running as an EAServer component, you must
call SetServerSideState if you want the component
to save state information. In other server environments, you only
need to keep a reference to the component in the session object
of the page server. The server component will attempt to keep the
retrieved data available until ServerSideState is set to false or
the server component goes away.
Controls
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Syntax
[Web DataWindow server component]
1 |
string <span>dwcomponent</span>.<span>SetServerSideState</span> ( boolean <span>maintainstate</span> ) |
Argument |
Description |
---|---|
dwcomponent |
A reference to a Web DataWindow server |
maintainstate |
Specifies whether the server will attempt
|
Return Values
Returns an empty string if it succeeds and an error message
from EAServer if it fails.
Usage
How state is maintained for a stateless component
The Web DataWindow can run in a fully stateless server environment.
Variables in the Web page keep information about the rows being
viewed and changes the user makes and this information is communicated
to the server component as needed so the component can restore its
state each time it is called. Restoring its state includes retrieving
data from the database each time the page is reloaded, including
each time the user navigates to another page.
Performance impact of a stateless component
Operating in a stateless mode minimizes use of server resources
but can decrease performance. The client maintains the state of
the server component in string form and the information is sent
back and forth with every request. Also, when state is not maintained
on the server, the component must connect to the database and retrieve
data each time it is called. If the component server does not do
connection caching, response time for the client could be very slow.
Maintaining state on the server
You can increase performance by maintaining state on the server.
To maintain state, the page server’s session object keeps
a reference to the server component. If the server component is
running in EAServer, you
must also mark the component as a stateful object. You can do this
by calling SetServerSideState or by setting the component’s
serverSideState property in EAServer Manager.
Maintaining state on the server will provide faster response
time if the same component is accessed again. However, it also increases
the server resources used for each client connection.
To minimize impact on server resources, a short timeout on
a session lets the server get rid of a component that might not
be requested again. If the component is called again, its state
can be restored from the client state information.
You can also increase performance by calling Update frequently.
For information about using the Web DataWindow, see the DataWindow Programmers
Guide.
Examples
This example specifies that the EAServer component should maintain state:
1 |
webDW.<span>SetServerSideState</span>( true ); |