How to access web.xml init parameters from java code?
You can get it using externalContext getInitParameter method.
For example, if you have:
<context-param> <param-name>connectionString</param-name> <param-value>jdbc:oracle:thin:scott/tiger@cartman:1521:O901DB</param-value> </context-param>
You can access this connection string with: \
FacesContext fc = FacesContext.getCurrentInstance(); String connection = fc.getExternalContext().getInitParameter("connectionString");
Comments