• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic