ADF11g-040:ADF中获取context param

通过以下代码可以获取web.xml中配置的Context Parameter

FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
ServletContext servletContext = (ServletContext) ectx.getContext();
String param1 = (String)servletCtx.getInitParameter("contextparam1");

如果想使用EL表达式则使用

#{initParam.contextparam1}

或者(参数中带"."号)

#{initParam['contextparam1']}

附web.xml

<context-param>
  <param-name>contextparam1</param-name>
  <param-value>value1</param-value>
</context-param>


你可能感兴趣的:(ADF,context,param)