| Author |
Session handling in Struts2
|
Pranav Nakate
Greenhorn
Joined: Aug 29, 2011
Posts: 9
|
|
Hi,
i learned J2EE a few months back and now i am learning Struts 2...
Can anyone explain me how the client session is created and handled in Struts2 ???
i came across an interceptor 'SessionAware' which exposes a 'Map session' to the action...
my doubt is whether this is the SAME as in the session created using 'HttpSession session=request.getSession() ' ...??? [ jst as i did in J2EE servlets ...]
Thank you in Advance...
Pranav
|
 |
Mohana Rao Sv
Ranch Hand
Joined: Aug 01, 2007
Posts: 485
|
|
|
ServletActionContext.getRequest().getSession(true); Found in create session interceptor.
|
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
|
 |
debraj mallick
Ranch Hand
Joined: Mar 08, 2011
Posts: 188
|
|
hi Pranav,
here are links which i hope will clear all your doubt,
http://struts.apache.org/2.2.3.1/docs/accessing-application-session-request-objects.html
http://struts.apache.org/2.2.3.1/docs/simplelogin-with-session.html
|
 |
Pranav Nakate
Greenhorn
Joined: Aug 29, 2011
Posts: 9
|
|
Mohana Rao wrote:ServletActionContext.getRequest().getSession(true); Found in create session interceptor.
Thanks Mohana...so that means in SessionAware interceptor, the session created is similar to what is obtained from the HttpServletRequest object or is there any difference?
i mean is it different from HttpSession object or its the same?
Thanks
Pranav
|
 |
Pranav Nakate
Greenhorn
Joined: Aug 29, 2011
Posts: 9
|
|
Hi Debraj,
my doubt is whether the session map obtained from SessionAware interceptor does the same job as "HttpSession session=request.getSession()" where request is an object of HttpServletRequest.... ???
|
 |
Mohana Rao Sv
Ranch Hand
Joined: Aug 01, 2007
Posts: 485
|
|
|
Same, Struts internally using servlets. You can consider struts is a top layer on the servlets.
|
 |
debraj mallick
Ranch Hand
Joined: Mar 08, 2011
Posts: 188
|
|
hi there,
i have given the link just to help but it seems like you did not gone thru the documentation of struts2,
the think you are looking for is
you can get session in this way also
|
 |
 |
|
|
subject: Session handling in Struts2
|
|
|