heitml takes the
World Wide Web
to a higher level!

Introduction
heitml Features
Language Guide
       

Language Reference

   General Design
   Lexical Structure
   Expressions
   heitml Tags
   heitml Functions
   Accessing databases
   Server Variables
   Sessions
   heitml Syntax
       
The heitml Libraries
Supported Platforms
User Guide
Download
User Registration
Discussion Group
Mailinglist
       
NEW!
heitml 1.2 new features


Send us mail

Contact Info

   

Language Reference
by Helmut Emmelmann, PhD
and Keith Oustalet

Session Mode
 

Example
Session mode keeps all the variables named se.name, where name specifies a particular variable on any page of your Session Mode Application. Session variables can use any data type you like, including tuples and arrays.

To use session mode you need to include the ses.hei Library, and put all of the Source Code from a Seesion Mode Web Page into the <session> environment Tag. Instead of the normal anchor tag <a ... > you need to use the <sa ... > tag.

So the simplest example for session mode is


<include ses.hei>
<session mode="create">
   <let se.i=default(se.i,0)+1>
   The number is <?se.i>.
   <sa href="sessimp.hei"> Increment </sa>
</session>

This will show a counter, and whenever the user clicks on increment it will increment the counter by one.  

How does it work ?

Once a user enters a session mode page, (s)he gets a session card number assigned (currently made up by the date, time, and ip-number). After processing of this page the session variables are written to a file (named as the card number).

Now when the user requests the next page session variables are read again. To know which session it is the session card number is passed from the first page to the second one, by adding it to the url. This is why you need to use the <sa ... &> tag. It automatically adds the card number to the requested url.

For forms there is another way to add something to the url. It is called hidden fields. All you need to do is to call the < sessionhidden > tag somewhere within your form, and session mode will work fine.

 

Starting Pages and Inner Pages

When using session mode many of you pages will require that certain session variable have been set already. Such a page must always be called from another session mode page. So we call it an inner page . In contrast pages where a session can start are called starting pages . By carfully setting your links, you can make sure inner pages are always called from another session mode page ..., except when a user types in an url of such a page directly.

heitml allows you to specify which pages are starting pages and which are inner pages using the mode parameter of the < session > tag. When a user tries to direcly access an inner page, he gets an error message, referring him to a starting page.

However still the user could by manually modifying urls confuse session files for several applications. This is why you can specify and application name in the session tag. Then heitml automatically checks that a session file and a page both belong to the same application.  

Handling the Back Key

Please remember, when writing an application, that the user can always use the back key in the browser. heitml session mode assists you in finding out, whether this has happened:

Dialog steps are numbered, starting from 1. The variable se.step contains the number of the current dialog step and se.laststep the number of the previous one. Usually there is se.step=se.laststep+1. However if the user has pressed back several times the step number is decremented accordingly. So se.laststep+1-se.step gives how often the back key has been pressed.

The number of the upcoming dialog step is passed as a second parameter within the url (just as the card number).  

Session Mode Tags

To use the following tags the file ses.hei needs to be included.

< session mode="std" start="/" appkey="" > ... </session >
This is the basic session mode environment, you have to enclose the whole page into it. The mode parameter can be "std" for an inner page and "create" for a starting page. In case an innerpage is called directly an error message is displayed. It tells the user to start at the url given as the start parameter of session. The appkey parameter gives an application name. When given, heitml makes sure that the session variables belong to the same application.
< sa href par=null urlpar""  > ... </sa >
The < sa > environment acts as a replacement for the < a > tag. It adds the card number to url called. par can be a tuple. The content of this tuple is added in the appropiate format to the url called. The urlpar parameter is a string, that is also added to the url.

If for some reason the sa tag is to restrictive, please use the sessionurl tag.

< sessionUrl >
creates url parameters to be added to a url for session mode. Normally you can just use sa, however, in some special cases sessionurl is more flexible. An example how to use sessionurl is <a href="mypage.hei?<sessionurl>">.
< sessionHidden > 
adds the neccessay parameters as hidden fields to a from. In session mode, you just add inside each form you are using.
< sessionCreate > ... </sessionCreate > 
The body of the sessioncreate environment is executed only if the user just entered session mode. This is a convenient way of initializing variables for session mode.

This page was dynamically generated by heitml
© 1996-1997 H.E.I. All Rights Reserved

heitml documentation (c) 1997 H.E.I. GmbH Mannheim, Germany