I have a JSF application that is going to be deployed on two different servers. Each copy of the application needs to access a service on one of another set of two servers. e.g. App on web server 1 ---> service running on Server A App on web server 2 ---> service running on Server B
I am currently setting the host of the service inside my faces-config.xml file, but what I would like to do is set this with some kind of placeholder value which would tell the app to read this from another file, e.g. a properties file. I could then deploy the app without any changes onto any server and the external properties would take care of the host name value.
I have done something similar using Spring's config files, but can't get it to work in my faces-config. Is this possible?
Many thanks. Steve [ November 05, 2008: Message edited by: Steve McCann ]
I don't consider the spring config file to be any more dynamic than the faces-config file in this context, but you can (and I do) use both Spring and JSF together.
What you really need I think, is JNDI. In the Tomcat server, for example, you can define the default value of a resource in the web.xml and then override it in the deployment descriptor for the webapp. You use JNDI to look up the resource value.
When you do that, you don't need to create 2 discrete WARs with different config into, you just need 1 WAR that you deploy with different parameters.
I've done this for years. It allows me to use the exact same WAR for development, Q/A testing and production where each level had its own databases and server context. Aside from keeping the overall architecture simple, it ensures that when a production system breaks, I'm debugging exactly the same code that broke in production. [ November 05, 2008: Message edited by: Tim Holloway ]
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
I agree with what you are suggesting, though unfortunately in this case I don't think it solves my problem.
I am using a 3rd party API which has several JSF backing beans predefined in the faces-config.xml. One of these requires the host name (or IP) of a mapping server and it is this that I would like to change.
I would like to be able to set this something like
Which would then be set via a .properties file in my JBoss server.