Which is better approach among four(HttpSession,cookie,URL
Rewriting, Hidden Fields) Session Tracking technic's ? Why ?

Answer Posted / sridhar

Best Approaches are HttpSession and URL Rewriting.....
in HttpSession when client sends the request to the server first time session object will be created.
HttpSession ses=Request.getSession(true);//if session is not created a new session will be created and JsessionId is sent to the client.if session is already created existed Jsession Id send to the client.
HttpSession ses=Request.getSession(false);//if session is already created the Jsessionid will send to the client
if not it will not create Session object.

If browser doesn't support cookies the appln will not work properly.
So to avoid this problem We can use UrlRewriting........

Is This Answer Correct ?    17 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the role of dispatcherservlet and contextloaderlistener.

607


Which event is fired at the time of session creation and destroy?

877


What is cgi?

598


What is difference between cookies and httpsession?

546


How to get the server information in a servlet?

685






What is the use of servlet wrapper classes?

673


What is the difference between CGI and Servlet?

590


How can you run a servlet program?

601


Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?

618


What do you mean by httpservlet and how it is different from the genericservlet?

538


What methods do you use in servlet - applet communication?

584


Difference between forward() method and sendredirect() method ?

584


What’s the difference between sendredirect and forward methods

565


What is meant by Servlet? What are the parameters of service method?

598


Whether thread can be used in servlets?

728