7 8 RDML COOKIES

LANSA Web Functions

7.8 <RDML COOKIES>

Syntax:

<RDML COOKIES="<page name>">

 

Description:

This tag allows you to set cookies in your application for your own specific purposes.

If you want to use this tag, this tag must precede the <RDML LAYOUT> tag in the page.

 

 

A cookie is a small piece of information which you can store on the client with a Web browser. At a later time, you can retrieve the information back from the browser. For example, cookies can be used by your application to identify the user. LANSA allows you to treat cookies as fields in your application. You can regard cookies as LANSA fields in your RDML function. Cookies are not used by the LANSA web function transaction server to maintain a persistent state in your application.

To set a cookie in your Web function, you will need to edit the HTML generated for the function to include the LANSA cookie tag:

<RDML COOKIES="&UDCOOKIES">

<RDML LAYOUT>

<!-- Process  : PCTEST   PC Test         -->

<!-- Function : TESTFUN  Test Function   -->

<!-- Page     : 001                      -->

The <RDML COOKIES> tag should be one of the first lines on the page and it must not be indented. It must precede the <RDML LAYOUT> tag.

In this example, a page called DEFAULT_UDCOOKIES is used. For more details about user defined pages, refer to User Defined Default Pages. This page can be created with the Web Function Editor and might contain the following statement:

        USRID=<RDML MERGE="EMPNO">; expires=Fri, 23 Jun 2000 07:00:00 GMT

        USRNM=<RDML MERGE="SURNAME">; expires=Fri, 23 Jun 2000 07:00:00 GMT

In this example, two cookies, USRID and USRNM, are set and will be stored on the client by the browser. The cookie USRID contains the value of the EMPNO field and the USRNM cookie contains the value of the SURNAME field.

Once you have set the cookies for your application, the cookies will be returned to any of your LANSA applications as LANSA fields. In the example above, if you want to read the value of the cookies, you will need to define fields in your RDML function for USRID and USRNM.

Cookies are created and stored with the CGI-BIN location as the name. When a process is setup with authentication a cookie will be created to correspond to the AUTHLIB location. For any subsequent requests, the cookies will revert to using the CGI-BIN location.

A client browser can be defined to not accept cookies. You must be careful about how you plan to use cookies in your application.