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

Answer Posted / amit singh (a.e.)

what is better approach or what is optional approach
those are different things,
HttpSession An Object Cookie An Object UrlRewriting Is An Object
I Dont Think So And Hidden Fields IS AN object i am bit of confused

Request.getSession(true/false);

Means Session Is Started In Itself Is Not It I Think It Is
On First Request,
Cookie,

Response.addCookies(Cookie Object);

Means In Response You Want To Add Cookies
But If Cookies Disable,
Means The Things You Want To Add In Response "Means To Track
User By Session Or By Cookie,

Url Rewriting Its An Approach When Cookies Is Disable ,
So Means
encodeUrl(/sjhf);
Different Apporoach,


Hidden Field Is Not A Way To Track User By Session Because Is Java,
Session Object Created Automatically On First Request,

But If You Want To Use All Predefined Approach ,Means You Are Not Aware So You Could Track A
Page On Every Get Or Post Request By
<input type="hidden" name ="amit" value="amit">
so On every Request By
request.getparameter("amit");
You Could Track Page And You Could Add It
And Then You Could Make On Every Page
A Hidden Field But Problem Is That It Was Just For
Fill Up Page But
In Next You Could Add It AS COOKIE OR CREATE IT AS COOKIE
OBJECT ,
COOKIE C= NEW COOKIE("AMIT/ALBERT");
SO YOU COULD DO ANYTHING THAT THE WAY YOU WANT
AND
SESSION WILL BE THERE BUT IN JAVA ITS ALMOST
DONE BY SESSION ID AND THAT ID WILL AS COOKIE
CONFUSED THEN DO PRACTICAL

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is dispatcher servlet a singleton?

546


What is http servlet? Explain with the help of an example.

581


How do you invoke a servelt?

628


Explain get and post.

649


What is the element?

590






What are the different methods involved in the process of session management in servlets?

669


What is servlet api used for conneting database?

700


When a servlet accepts a call from a client, it receives two objects. What are they?

766


How is the get () method different from the post() method?

537


Explain the jar and war files in servlet?

557


What are the functions of Servlet container?

609


What is the web server used for running the Servlets?

581


What is cgi and what are its drawbacks?

553


What is the use of httpservletrequestwrapper and httpservletresponsewrapper?

542


What are the mechanisms used by a servlet container for maintaining session information?

568