从Servlet代码修改上下文参数 [英] Modify context param from servlet code

查看:174
本文介绍了从Servlet代码修改上下文参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何获取上下文参数,但是有没有办法更改web.xml中定义的上下文参数的值?我正在使用JSF,因此在这种情况下它将为FacesContext.

I know how to get the context params, but is there a way to change the value of the context params defined in the web.xml? I'm using JSF so in this case it will be FacesContext.

推荐答案

您可以并且不应该以编程方式更改它们.这会打败他们的目的.只需直接在web.xml中更改它们,或寻找其他解决方案-我无法建议,因为尚不清楚此需求背后的具体功能要求.我至少可以暗示JNDI可以覆盖某些特定的上下文参数,例如

You can and should not change them programmatically. It would defeat their purpose. Just change them straight in the web.xml, or look for a different solution --which I can't suggest as the concrete functional requirement behind this need is unclear. I can at least hint that some specific context parameters are overrideable by JNDI, for example the javax.faces.PROJECT_STAGE.

这篇关于从Servlet代码修改上下文参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆