This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSF and the fly likes Set managed property in faces-confg from .propoerties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Set managed property in faces-confg from .propoerties file" Watch "Set managed property in faces-confg from .propoerties file" New topic
Author

Set managed property in faces-confg from .propoerties file

Richard Gray
Greenhorn

Joined: Aug 08, 2008
Posts: 13
Is it possible to set a managed property in a faces-config.xml from a .properties file like:

<managed-property>
<property-name>dbName</property-name>
<value>prop.getProperty("database.name")</value>
</managed-property>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17011
    
  26

No, you can't put Java code in faces-config. You can, however use EL. So as long as you have the bean in question mapped under a name in a context that the EL processor can use, you can do it. However, I don't know anything that's available off the shelf.

If you are using Spring and have added the Spring EL properties resolver to the faces-config, you can let Spring construct a bean based on those properties and inject it into JSF.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Set managed property in faces-confg from .propoerties file
 
It's not a secret anymore!