Show TOC

setPersistent FunctionLocate this document in the navigation structure

Use

Purpose

Makes data persistent for an entire user session or removes the persistence.

The context is initialized at the beginning of each request, so the lifetime of context data lasts no longer than the duration of one request/response cycle. Since there can be several such cycles during a user session (which lasts from user logon to user logoff ), the data merged from the service files is, by default, the only data that is persistent for the duration of a user session.

This function allows you to make any data persistent for an entire user session in a session context rather than just for one request/response cycle.

To find out whether context data is persistent for an entire user session or not, you can use the getPersistent function.

Syntax

setPersistent (<cntxtvarname>, <value>)

Description

  • If you call this function by specifying a context variable name cntxtvarname and setting the value value to 1, the ITS writes the context data defined by the context variable to the session context, so that it is retained for the entire duration of the user session.

    If no session context exists when you call the function, the ITS creates it.

  • If you call this function by specifying a context variable name cntxtvarname and setting the value value to 0, the ITS removes the context data defined by the context variable from the session context, so that it is no longer retained for the entire duration of the user session.

The session context and the session container are deallocated at the end of each user session.

Example

Make data persistent for an entire user session:

`setPersistent (cntxtname, 1)`

Make data no longer persistent for an entire user session:

`setPersistent (cntxtname, 0)`