Hi
I like to know is there only one way to call session using request.getSession()
or is there any other way?
views:
61answers:
2
+2
A:
The api shows two methods. Basically one creates the session for you if needed, and the other doesn't.
http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html#getSession%28%29
and
Yoni
2010-01-15 07:14:30
He might not be expecting this. But its fair enough. +1
Adeel Ansari
2010-01-15 07:15:44
A:
If you're thinking of something like MagicSessionSignleton.getSession()
, that can be called from anywhere in the code, unfortunately there isn't. You can however, build a filter that does that for you (or use a framework that provides simple access to the request/session context).
FRotthowe
2010-01-15 07:21:01