• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

managed property does not work

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic