File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Session management Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session management" Watch "Session management" New topic

Session management

Teajl Shah

Joined: Jun 02, 2000
Posts: 11
Hi all,
I have just started learning JSP and have some Qs.They may be very basic but I am confused,so please help me
1.What is the functional impact on the session when dial-up connection dropped between the requests but quickly reconnects(within few seconds)?
2.ServletRequest interface has a method getRemoteHost(),why can't we use the simple IP address to identify a perticular client?
Thanks all,
Preethi M

Joined: Oct 24, 2000
Posts: 22
hi shah!
Answers to ur questions:
1.if u close ur browser and open it again ur session gets expired.otherwise there will be no impact on also depends on the expiry date of the cookie.
2.ur idea is very good,but think what if i am connected to a proxy server.for eg.if i am connected to a proxy server,users are shopping and their selected items are stored in a session,when we r retrieving the items they get replaced since it is the same IP address for all the clients.
hope u find this information useful.
Nitin Dabadghav

Joined: Jun 28, 2000
Posts: 13
1) Your session terminates only when your browser is terminated or if you have specified a specific time for your session cookie.
But according to me If your connection fails or a few seconds it won't matter as the session will be the same.
2) In this case you are trying to hard code an IP address whereas different client have different IP addresses.
Teajl Shah

Joined: Jun 02, 2000
Posts: 11
Thanks Preethi and Nitin.It really helped
one more qs.
which session management technique requires minimal amount of code if we can control the clent(browser) configuration?
lokesh reddy
Ranch Hand

Joined: Sep 15, 2000
Posts: 66
Hi Shah,
HttpSession session management technique is very easy to implement and it requires a minimal amount of a code.
Try to implement this in ur project
Preethi M

Joined: Oct 24, 2000
Posts: 22
Hi Teajl,
When dealing with small sets of public data using cookies or URL rewriting is accepatable.
when dealing with private and large amounts of data preffered method is to use HttpSession by sending small amount of data to the client u can associate each user with large amount of data on the server.
Good Luck
I agree. Here's the link:
subject: Session management
It's not a secret anymore!