• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session question

 
Ram Kas
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JSP page as view.
A servlet as controller.

I want to get session information from view to controller.

Can anybody tell me how I do it?

Thanks in advance.
Dinakar Kasturi.
SCJP1.4
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One would normally use the HttpSession mechanism provided by the servlet and jsp API. What have you tried so far? What happened when you tried it?

Bill
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use request.getSession() from controller / servlet. And request in this case is HTTPServletRequest.Well jsp is the one that would be converted to a servlet and then the converted servelt would produce the required HTML output for the browser.And session tracking is done using cookies and transfering a sessionID in it.If a session is created then you will always get session from request.getSession(false) always for all subsequent request and null in case session is not created.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!