what is use of session tracking ?with example?
Answer Posted / 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 View All Answers
When can you say a graph to be a tree?
What is unsigned char?
Do I need java on my computer?
What are the different conditional statements?
What about interthread communication and how it takes place in java?
What is the benefit of inner / nested classes ?
How do you allocate memory to object?
What is field name?
What is meant by polymorphism?
What is the use of predicate in java 8?
Can we create constructor in abstract class ?
Can we inherit a class with private constructor?
What is getclass () getname () in java?
What Is Composition?
What are the pillars of java?