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
What is meant by 'bit masking' in java?
What is default switch case? Give example.
Where pragma is used?
What does 3 dots mean in java?
How many types of threads are there in java?
What is difference between path and classpath variables?
Define an abstract class with reference to java.
What is locale?
what is bmg file and how to create that files?what will it contailn?
Can a source file contain more than one class declaration?
What is a dot notation?
Is multiple inheritance supported by java?
What is scope & storage allocation of global and extern variables? Explain with an example
Does chrome use java?
Can we have any code between try and finally blocks?