开发者

Passing init params to Manage bean

I have a authorization managed bean to fetch restriction rules to be applie开发者_JAVA百科d to the tags within every jsf of the application. The managed bean requires to know the name of the requested jsf on initiation so it can fetch restrictions specific to the tags within that jsf. What is the best way this can be achieved ?


Declare it in web.xml as follows:

<context-param>
    <param-name>paramName</param-name>
    <param-value>PARAM_VALUE</param-value>
</context-param>

Access it in ManagedBean as follows:

FacesContext.getCurrentInstance()
                .getExternalContext().getInitParameter("paramName")

Hope this helps to solve your problem.


You can get init-params defined in web.xml by:

FacesContext.getCurrentInstance().getExternalContext()
    .getInitParameter("paramName");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜