OpenWGA 7.0 - TMLScript reference

Method :

createCookie(name, value)

On object WGA
Usage Creates a browser cookie object that can be added to the users browser session
Description The cookie object created is a Java object defined by JavaEE. For a complete reference see JavaEE API Dokumentation.

The created cookie object is not yet added to the users browser. That is done with method "this.response.addCookie()" which takes the cookie object for parameter. Before that you can still modify the cookie to you needs.

You should call "addCookie()" in a WebTML action for it to be early enough to be set as HTTP header. However some application servers may still prevent this, so that this technique is not usable on them.

For backward compatibility there still is a method "createCookie()" available on TMLContext whose use is discouraged since OpenWGA 5.3.

Parameters name (String):
Name of the cookie to set

value (String):
Value of the cookie
Return value A new Java object of type Typ javax.servlet.http.Cookie
Allowed in script types
  • WebTML pages and normal WebTML actions