• 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

SessionAware does not inject session Object

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

Once more here I come with a question of s2, i'm a beginner at it and got some trouble finding examples.

I'm build a menu service wich depends upon a login, wich is give when the user enter at start page. Once the login has been made, I store the user object into the session by doing the follow:




and then the doLogin method


Now comes the problem, I have a MenuBean injected on the MenuAction by the following xml piece on ApplicationContext.xml





And the menuAction is declared as follow:


By doing so I need to implement the session set with a private member


The failing part of all its the method bellow, the session object is null at debugging:

Does anyone know why? or how to implement it? Looking at the code above, i need 'Perfil' from the user wich is logged on, if the session contains the key to the user object i get it and then use the perfil to populate the Menu through the setter and return SUCESS, otherwise it'll return INPUT wich will lead to the login screen.


Thanks in advance.
 
Diego Magalhães
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After some ours I managed to discover the error. wich lies not in the program but in the struts.xml, I've written a custom stack for the application:





And somewhat forgot to include session-related items, with the defaultLoginStack changed to




I'm now able to use session injected correctly.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic