• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session in Strut2

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use SessionAware interface for setting session in your action class. Example...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic