Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



Which is better approach among four(HttpSession,cookie,URL Rewriting, Hidden Fields) Session Track..

Answer / 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

Which is better approach among four(HttpSession,cookie,URL Rewriting, Hidden Fields) Session Track..

Answer / nagaraju

HttpSession with cookies is the best approach

Is This Answer Correct ?    4 Yes 1 No

Which is better approach among four(HttpSession,cookie,URL Rewriting, Hidden Fields) Session Track..

Answer / 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

More Servlets Interview Questions

Which method of the httpservletrequest object is used?

0 Answers  


What is Difference between JavaBeans and taglib directives?

3 Answers  


When servlet object is created?

0 Answers  


Which event is fired at the time of setting, getting or removing attribute from application scope?

0 Answers  


Can you call a jsp from the servlet?

0 Answers  


How forward () method is different from send redirect () method?

0 Answers  


What are the different methods of session management in servlets?

0 Answers  


What are the objects involved when a servlet receives a call from client?

0 Answers  


What is servlet initializer?

0 Answers  


Where do you define dispatcherservlet?

0 Answers  


Which httpsession object is used to view and manipulate information about a session?

0 Answers  


What happens, when client requests for server object, which is not yet loaded into the memory?

2 Answers  


Categories