• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading a managed property

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic