[OmniFaces utilities] The
getInitParameterMap()
method returns the application initialization parameter map. This returns the parameter name-value pairs of all <context-param>
entries in in web.xml
.[OmniFaces utilities] The
getInitParameter()
method returns the application initialization parameter. This returns the <param-value>
of a <context-param>
in web.xml
associated with the given <param-name>
.Method Faces#getInitParameterMap()- get the application initialization parameter map:
See also: Faces#getContext()
Method Faces#getInitParameter()- get the application initialization parameter:
See also: Faces#getContext()
Usage:
Below you
can see an example of listing the content of this map:
import
org.omnifaces.util.Faces;
...
Map<String,
String> initmap = Faces.getInitParameterMap();
for
(Map.Entry<String, String> entry : initmap.entrySet()){
System.out.println(entry.getKey() +
"/" + entry.getValue());
}
And a
possible output:
org.jboss.weld.context.ignore.forward/false
resteasy.injector.factory/org.jboss.resteasy.cdi.CdiInjectorFactory
org.jboss.weld.context.ignore.include/false
javax.faces.PROJECT_STAGE/Development
resteasy.unwrapped.exceptions/javax.ejb.EJBException
org.jboss.jbossfaces.IS_CDI/true
Or, if you
know the name of the desired parameter, then you can use Faces#getInitParameter():
// e.g. Development
String stage
= Faces.getInitParameter("javax.faces.PROJECT_STAGE");
Niciun comentariu :
Trimiteți un comentariu