This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes Session handling in Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Session handling in Struts2" Watch "Session handling in Struts2" New topic
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

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Session handling in Struts2
 
Similar Threads
Struts2 struck with a issue of 404
Struts2 Action problem Problem
Jsp is not displaying in Struts2
LazyInitializationException [spring + struts2]
Getting Session in Struts2