vivek_saxena
Welcome to the
Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our
naming policy here at the ranch. Please
change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
For your first question you can use a session variable to store th users login name or just a Boolean. Then on all of your pages just check this variable to make sure it has a name in it or the Boolean is true. When they hit your logout button jst set the variable to "" or false depending on what you use. It will alos get set to null if the session times out.
As far as I know there is no easy, reliable way to detect when a user leaves your pages. Someone else here might ave mroe input on that.