what is use of session tracking ?with example?



what is use of session tracking ?with example?..

Answer / sivasubramanian.k

Session Tracking is one of the most powerful features of
Servlets and JSP. Basically, the servlet engine takes care
of using Cookies in the right way to preserve state across
successive requests by the same user. Your servlet just
needs to call a single method (getSession) and it has
access to a persistent hashtable of data that's unique to
the current user

public void doPost(HttpServletRequest request,
HttpServletResponse response){
...
//lets take the session obj
HttpSession session = request.getSession(true);
//now let us take the user name assosiated with this session
String currUserLogin = (String) session.getAttribute
("currentUserLogin")
...
//now we do the work according to the user name
doSomeWork(currUserLogin);
...

}

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Core Java Interview Questions

How the interruptible method gets implemented?

0 Answers  


What will happen if we write code like: try{}catch(exception e)catch(IOException i)

6 Answers   CTS, TCS,


As a developer what steps do you take to improve the performance?

4 Answers  


What are the 4 versions of java?

0 Answers  


What is a numeric string?

0 Answers  






Explain the use of volatile field modifier?

0 Answers  


how your day start in your company

1 Answers  


What is final access modifier in java?

0 Answers  


How big is a pointer?

0 Answers  


How to avoid the runtime exception ?

2 Answers  


What is sleep method?

0 Answers  


what is stringtolennizer with example?

2 Answers   Symphony,


Categories