1 4 3 Being Stateless

LANSA WAM

1.4.3 Being Stateless

One of the key points about WAMs is that they are stateless. In fact, any internet-based application is stateless. What this means is that when a WAM is executed from the Presentation Layer, it runs (a job is initiated on the server), produces some output (a web page), and then ends (the job on the server ends and control is transferred back to the browser).

The job starting and ending, to all intents and purposes, is a "transaction". Any data that needs to be maintained for the user's web "session", i.e. span multiple transactions, must be kept somewhere. A good example of this is when a user logs on to a website. The fact that they're logged on needs to be maintained across multiple transactions, as certain functions of the application may only be executed if they are logged on.

In a windows or green screen application, this is all implicit – the user's job stays alive in memory, waiting for the next move from the user. But on the web, we don't know what the user might do next – they might key in a new URL, hit the back button, close the browser and so on.

Data to be displayed on the web page is moved back and forth courtesy of Web Maps. Even data that is hidden is moved back and forth. But this shouldn't happen in the case of "session" data. This is data that is important to the Application Logic Layer only, and doesn't influence what happens in the Presentation Layer.

WAMs supports this idea of session data by using a special value of *none in the For parameter of the web map and a value of *persist in the web map's options parameter. A web map to maintain the log on status of a user might look like this:

Note the placement of the web map. Because it is global, all Webroutines in the WAM will adopt it. It makes a lot of sense to code your session data Web Maps in this way – so that the data is mapped in and out at all times.

There are other parameters and settings that need to be taken into account when coding for session data, but you should now have the basic idea. Refer to WAM Session Management for more information.