SetServerSideState

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.

Obsolete method

SetServerSideState is obsolete and should not be used, because the Web DataWindow technology is obsolete.

Applies to

DataWindow type

Method applies to

Web

Server component


Syntax

Web DataWindow server component

string dwcomponent.SetServerSideState ( boolean maintainstate )

Argument

Description

dwcomponent

A reference to a Web DataWindow server component

maintainstate

Specifies whether the server will attempt to maintain its state between method calls. Values are:

  • True -- The server component will keep the result set and keep the transaction open if possible.

  • False -- (Default) The result set is not saved and the server component uses information passed back from the client to retrieve the result set again and remember any uncommitted changes.


Return value

Returns an empty string if it succeeds and an error message from server 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.

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.

Examples

This example specifies that the server component should maintain state:

webDW.SetServerSideState( true );

See also

Update