• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Handling HttpSession  RSS feed

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do i handle HttpSession in MVC architecture?
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "handle?"
Basic functionality is....
You can obtain the current HttpSession object from the request object through:
HttpSession session = request.getSession(true);
specifying "true" will create a new session if one does not already exist.
You can put stuff into and get stuff out of your session thusly:
session.setAttribute("key", value);
The key in the set method has to be a String, but the value can be any object.
Thus you can get your session and its attributes anyplace you can access the request object. (mostly on a JSP or in a Servlet).
[ August 18, 2003: Message edited by: Brian Wainwright ]
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!