Author
session in Strut2
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
What is the best of way of defining the session in strut2.
I define the session in my application as .
Map session = ActionContext.getContext().getSession();
session.put("loginDetails", user);
Is any other best way to define the session in strut2.
Thanks.
Leonardo Carreira
Ranch Hand
Joined: Apr 07, 2009
Posts: 482
Hi..
I think that's the only one way to use Session in Struts2..
Because i've used it too..
Correct me if i'm wrong..
Thanks in advance..
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot ] [JavaChamp ] [JavaPrepare ]
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
Actually i am facing a problem.When more than one user login in the application .Some time its show the data of other user to other user.
Please tell me where i am wrong.
Thanks
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
You can use SessionAware interface for setting session in your action class. Example ...
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Aug 16, 2009 13:47:01
0
Implementing SessionAware is the best way to get access to the session, and makes testing easier.
If you're getting session "crosstalk" then it's nearly certain you're doing something wrong; without code (and possibly configs) it's impossible to help.
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
Hi,
When the user login .
I set the session as
Map session = ActionContext.getContext().getSession();
session.put("loginDetails", user);
And in other action i am getting the user information as
Can any body tell me where i am wrong.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Aug 17, 2009 07:58:52
0
That code is fine.
What makes you think you're getting session crosstalk? How are you confirming you're having a problem?
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
Hi,
Actually this kind of problem coming from specific location.
And i found that they using proxy server.
Is there any code that the data should be pick from server not from proxy server cache.
Thanks
subject: session in Strut2