• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session handling in Struts2

 
Pranav Nakate
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletActionContext.getRequest().getSession(true); Found in create session interceptor.
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
 
Pranav Nakate
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same, Struts internally using servlets. You can consider struts is a top layer on the servlets.
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic