Whitebeam Template Reference Documentation

Site Map
Application Guide
  XML Markup
  JavaScript Classes
  Dev Process
  External Links
  Example libraries
Contact Whitebeam
Whitebeam Users

Whitebeam Template Reference Documentation

System Template


Add the Whitebeam session ID into the URL provided.


string = rb.page.session.url(url, escapeAmp)


The 'session.url' method takes 2 parameters:

Name Type/Value Range/Length Description
urlstring  Required. The basic URL to encode with the Whitebeam session ID.
escapeAmpbool  Optional, default = true
Whether ampersands inserted into the modified URL should be escaped


The 'session.url' method returns string:

Type/Value Range/Length Description
string  Return a URL including the Whitebeam 'session ID' marker.


This method allows the web designer to store application specific data against the users session. That information can be subsequently retrieved using the rb.page.session.read method.

For this mechanism to work the Presentation Engine assigns each session a unique ID. The value of the ID is not important - it is however important that with each page requested by a client - that ID can be retrieved.

Two mechanisms are used. Firstly the Presentation Engine embeds the ID in a special Whitebeam client side cookie. This is the prefered mechanism and it will always work provided the client has cookies enabled.

If a client wants to ensure that the ID is correctly maintained for clients that do not allow cookies the ID must be embedded in all URLs that refer back to the same site. The encoding of this is to add the parameter onto the URL as a 'GET' parameter. The format of this encoding can be seen as follows:

Original URL


Encoded URL


This method will always return a JavaScript object. If no data has been stored with the session then the object will contain no properties. You cannot test for the presence of session data by testing whether or not the result is undefined!


This example reads the session data, checks for a 'userInfo' are and if not present creates it. Finally it writes the modifications back to the system template so they are available the next time the a page in the site is accessed.

   // Read any existing session data.
   var sessionData = rb.page.session.read();

   // Check to see whether there is a 'user' object already.
   if (!sessionData.userInfo) {
      // No data - create it
      sessionData.userInfo = new Object;
      sessionData.userInfo.name = "Fred";
      sessionData.userInfo.id   ="44523";
   // Finally store the session data ready for the next access.

Note this is the recommended way of using session data.

  • Read the current contents of the object.
  • Make modifications for this page.
  • Finally write the data back to the template.
Whitebeam release 1.3.36
(loadtime : 123ms)