• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to pass session object in other Action class

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx it works.
 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic