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.