File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes managed property does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "managed property does not work" Watch "managed property does not work" New topic

managed property does not work

A. Dusi
Ranch Hand

Joined: Sep 27, 2004
Posts: 114
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

Joined: Sep 27, 2004
Posts: 114
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....
I agree. Here's the link:
subject: managed property does not work
It's not a secret anymore!