This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes getSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "getSession" Watch "getSession" New topic
Author

getSession

ahamed irshad
Ranch Hand

Joined: Feb 26, 2010
Posts: 31

can anyone explain me request.getSession() with a simple example?thanks in advance


You can do anything, but not everything
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What specifically don't you understand? And what would an example look like other than setting a reference to it?
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Lets go:
with

you get a new session if doesnt exists.

If you do

if the session doesn't exist it wont creat one.

You can use session to store objects to navigate beetwen the requests. Like an user attribute.

C ya


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: getSession
 
It's not a secret anymore!