PDA

View Full Version : session management


mohan
09-24-2003, 10:30 PM
Hi Antun,

How do i manage session in laszlo?
Actually in our appln we are maintaining the session for each users who are all using our site(i.e user id,information about the shopping cart etc..).Is there any API for session tracking?


Thanks
Mallesh

antun
09-24-2003, 11:16 PM
You mean you want people to be able to log in and out? Use a jsp or other server-side script to talk to the database that holds the login info. Have the script accept GET variables, and return XML.

Use a <dataset> as the interface.

-Antun

mohan
09-30-2003, 06:38 AM
Hi Antun,

We are not only maintaining the login and logout,but we are maintaining the entaire session of the particular user. (since from login, other necessary transactions like shopping and then logout. )
so how do i do in laszlo.




Thanks
Rudresh

antun
09-30-2003, 04:54 PM
Everything that happens in a single "run" of a Laszlo app can be called a "session". You have access to all the same variables so long as you don't navigate away from or reload the page.

Now if you're talking about maintaining session information across page refreshes, then you'd need to create some sort of session management system yourself. A model for this might be:

[list=1]
User starts Laszlo app for the first time, and performs some action that you want recorded (e.g. add item to cart). The app sends a request (via a dataset) to a script on the server. The script generates a unique ID and returns that as XML to the client, while recording the action on the server (either in a database or filesystem).
The client receives the unique ID (session ID) and stores that on the browser as a cookie using browser javascript. See here on how to do that:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=242

While the app is running, it sends requests some server side script (along with the unique ID) and that script adds/updates the session log.
When the user returns to the site at a later time, the app queries the server-side script, and the script picks up the cookie information from the request. It looks up the details in the database or filesystem, and returns them to the client.
The client then uses this information to repopulate the cart etc.
[/list=1]

Does that answer your question?

-Antun

mohan
10-02-2003, 06:48 AM
Hi Antun,

Regarding about maintaining session information across page refreshes,
Is it mean, i have to maintain user information (i.e name,address etc..)as well as action that user want to record in database, and get the userID as the unique key and store it on the browser as cookie
By using that cookie he can retrieve the recorded information?


I need more help on "session log" and "read the cookie from the request".



Thanks alot
Mallesh

antun
10-03-2003, 11:54 AM
You might find this week's tip on sessions useful:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=423

-Antun