Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

managed property does not work

 
A. Dusi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a managed bean called createUserBean and managed property called resource of type Resource. resource and createUserBean are both set for session scope. This Resource class has a property called currentUser of type User, which is a business object and has getter and setter methods for it. User class as such has a property userId with its getter and setter methods.

Problem: When I referencing userId in my JSF:
<h:inputText id="inputText1" value="#{resource.currentUser.userId}" /> and submitting the form it gives me an error:Error during model data update.
But when I give the value as #{createUserBean.resource.currentUser.userId} it works( I can see that its calling the setter method setUserID of User in the logs). I also have other fields in the JSF directly referencing properties and methods from createUserBean like action="#{creatUserBean.add}"
Where am I going wrong?
Actually I am a bit confused about this managed property - What exactly is the purpose of managed property?
In my above problem, how does it know that resource is a managed property of createUserBean unless you specify that createUserBean is the managed bean for this JSF?
Shouldnt we use the first syntax anytime?

Thanks for any inputs.
 
A. Dusi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind. I thought I put the resource bean in session scope, but apparently not. And the reason why it worked with prefix createUserBean is that I initialized the resource bean in its getResource() method.
So resource.currentUser.userId works....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic