• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to pass session object in other Action class

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a action class Login action.

where i have store the use name in the session object.

I want to get the value of this session in other action class.

How it can be done .Please help me.

here is my code of Login action.

addDataToSession(user);


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...

It's a map. Get it from the map.Although I'd argue it's cleaner to get the session map via SessionAware, since it'll be easier to write your test cases.

Wishful thinking, perhaps, but the capability is there.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx it works.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i have a little question..

example :

i have Action class :
1.) SuperClass implements SessionAware (which getting a session value)
2.) SubClass1 extends SuperClass
3.) SubClass2 extends SuperClass

is it the both of SubClass1 and SubClass2 can "read" the session value?..

thank's

Sorry my english isn't too good
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just try it?

In any case, general Java questions should be asked in one of the Java language forums; this one should be in the "Java Beginners" since it's regarding simple inheritance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic