Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to access a managed bean from a button action listener ?  RSS feed

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
thank you for reading my post
how i can access a managed bean from a button action listener ?
for example i have a managed bean named session and its scope is session , i used it to store user details until he/she logout
and when he/she pressed the logout button i need to change some of that managed bean propertye ,
can you please tell me how i can do it ?
I also need it for time that user press the login button.
thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your backing bean(s) have a property for this session object you have created and have at the very least a setter method for it. Then, inject that property into you backing bean(s) using the managed-bean facility.



<property-name>session</property-name> - session is the name you gave the object in your backing bean

<value>#{sessionScope.session}</value> - session is the name you gave the object when you placed it into the session to begin with (which could also just be another managed-bean)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!