OpenWGA 7.0 - TMLScript reference

TMLContext "this"
Property :

cookies

On object TMLContext "this"
Usage Represents the browser cookies of the current user
Description Returns an Array of JavaEE cookie objects, representing the cookies that are set for the current browser session.

Every cookie object has the properties name, value, path, domain and more. For a complete reference see the  JavaEE API Dokumentation.

Returns null if there are no cookies.
Writable False
Return value Array of Java objects of type javax.servlet.http.Cookie
Allowed in script types
  • WebTML pages and normal WebTML actions
Examples Retrieving properties from cookie objects.

this.cookies[0].name
this.cookies[0].path


Since the property returns null if there are no cookies it is neccessary to test for it before testing the length of the cookies array:

if (cookies != null && cookies.length > 0) {
  // Now we can safely address cookies[0]
  return cookies[0].name;
}