• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I get a reference to my beans from PhaseListener

 
Anthony Taylor
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to get a reference to my BackingBeans from the PhaseListener with no luck. I tried two different approaches so far. 1) tried to pull the Bean object out of the request. 2) I tried to pull the bean object out with the ELResolver. Both approaches give me the BackingBean, the only problem is that properties of the BackingBean are all null. Unless I am mistaken, shouldn't the properties have values after the Update Model Values phase? If I tried to access the properties from within the bean, through an action, the properties have values. Strange behavior. Could someone shed some light on this problem.
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try changing managed-bean-scope to session in faces-config ?

Thanks,
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on second thought, why do you want to get managed bean in phaseListener ? if you are looking for the value of a particular component, you can get it inside the listener class.

Thanks,
 
Anthony Taylor
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a long story, but in a nutshell, I need to be able to get a reference to the object and pass it along to another object for manipulation. According to the rules for the various Phases, I should be able to achieve this. I just don't understand why the values are not set after update model values phase.
 
Anthony Taylor
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a long story, but in a nutshell, I need to be able to get a reference to the object and pass it along to another object for manipulation. According to the rules for the various Phases, I should be able to achieve this. I just don't understand why the values are not set after update model values phase.
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried to get my managed bean in phase-listener . As you said, the properties of the bean where showing null. I changed the scope of my managedbean to session in faces-config and I was able to get the property values in PhaseListener. I cant put a solid explanation for why the request scope didnt work but as a workaround keeping managed bean in session will work for you !

Thanks,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!