• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Session question

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic