• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session tracking in JSP and servlets  RSS feed

 
Neel Sharma
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know about session tracking in JSP and servlets.
Recently i read that by default session attribute is true in JSP's.
So, if its true..do we still need to enable cookies to maintain session ?
And if they are not enabled do we need to perform url rewriting?
Or if the session is true by default we don't have to worry about above 2 things.
Can anybody explain please..




Thanks
Neel
 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sharma,
Bundle of questions, What is your requirement?
Go through webpage once.
Still if uou need clarification feel free to ask me.
 
Neel Sharma
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rk sharma wrote:Hello Sharma,
Bundle of questions, What is your requirement?
Go through webpage once.
Still if uou need clarification feel free to ask me.


Thanks Mr. RK sharma. The link you gave me is very much explanatory.

Here what i understood..."In JSP's session attribute is by default set to "true" you don't have to set that explicitly "

So it means, now I can track session in JSP by any of the session tracking ways like below:

1:Cookies
2:URL Rewriting
3:HttpSession Object

So, What exactly Session="true" does? It just enables us to maintain the session by several ways.

And in JSP's the session would be tracked as same as in servlet.

Is my understanding correct? I hope now you got my question.

Thanks
Neel

 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The internal mechanism is same for jsp and servlet. Here using which session tracking mechanism is not the case. But using HttpSession and Cookie are very general.
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neel Sharma wrote:
So, What exactly Session="true" does?


Are you talking about this code?
If so, the explanation is given below.

An HttpSession object is created if one does not already exist for that client when the request.getSession(true) method is called with the argument true.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!