Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a managed property

 
Yellapa Adepu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I know that we can read a managed property by defining it in faces-config.xml. But I would like to know how to read directly in backing bean. I men what is the API method to retrieve a specific managed property from FacesContext.

Your help is appreciated.

Thanks,
 
Tim Holloway
Bartender
Posts: 18419
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're looking through the wrong end of the telescope.

Managed properties are properties which are managed by virtue of having been specified in the faces-config file. The faces servlet compiles faces-config and injects these values into the managed beans.

What that means is that you don't go to the FacesContext and retrieve properties. Instead you define your own beans and JSF injects the data values into them using standard javabean setter techniques.

FacesContext doesn't even have a place to hold properties. When you define a managed bean with session scope in a webapp, as an example, JSF constructs the managed bean, injects the managed properties, and stores the bean in the Http Session using the same mechanism as if you wrote a servlet that created a javabean, initialized it and saved it in the Http Session.

In other words, the real magic of JSF is that there really isn't any magic.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!