<session></session>
Provided by module: Tags: Session tag module
Creates a session bound scope. The session is
identified by a session key, given as an argument to the session tag.
The session key could be e.g. a value generated by
&roxen.unique-id; which is then transported by form
variables. An alternative which often is more convenient is to use the
variable client.session (provided by this module) together with the
<force-session-id> tag and the feature to set unique browser
id cookies in the http protocol module (located under the server ports
tab).
The following fragment sets up a new session with a variable in it
<!-- Force a session ID if one doesn't exist -->
<force-session-id />
<session id='client.session' scope='mysession'>
<!--
Our current scope is now the 'mysession' scope. Any variables
created in this scope will be accessible wherever the same
session is set up at a later stage.
-->
<!-- Create a variable in the scope -->
<set variable='_.message'>Hello World!</set>
Variable 'message' in the scope 'mysession' is now created in session id &client.session;:<br/>
&_.message;
</session> |
And the following fragment uses the same variable in another page
<!-- Make sure things are not over cached -->
<nocache>
<!-- Force a session ID if one doesn't exist -->
<force-session-id />
<session id='client.session' scope='mysession'>
<!--
Inside this container, we now have access to all the
variables from the mysession scope again
-->
Variable 'message' in the scope 'mysession' in session id &client.session;:<br/>
&mysession.message;
</session>
</nocache> |
Attributes
- id="string"
-
The key that identifies
the session. Could e.g. be a name, an IP adress, a cookie or the value
of the special variable client.session provided by this module (see
above).
- life="number" (900)
-
Determines how many
seconds the session is guaranteed to persist on the server side.
If the module isn't configured to use a shared database, then
values over 900 means that the session variables will be moved to a
disk based database when they have not been used within 900
seconds.
- force-db
-
If used, the session variables will be
immediatly written to the database. Otherwise session variables are
only moved to the database when they have not been used for a while
(given that they still have "time to live", as determined by the
life attribute).
Setting this flag will increase the integrity of the session, since
the variables will survive a server reboot, but it will also decrease
performance somewhat.
If the module is configured to use a shared database then sessions
are always written immediately, regardless of this flag.
- scope="name" (session)
-
The name of the
scope that is created inside the session tag.