浏览 6084 次
该帖已经被评为精华帖
|
|
---|---|
作者 | 正文 |
发表时间:2005-07-20
webwork.custom.i18n.resources 和 webwork.custom.properties 如果要配置多个 properties 文件, 可以用逗号隔开配置, 但是如果文件很多, 写起来比较麻烦, 所以我对 Configuration 做了一个扩展, 可以支持通配符配置, 例如 webwork.custom.i18n.resources = ApplicationResources, org/summerfragrance/security/web/webwork/* 就可以将 org/summerfragrance/security/web/webwork/ 下的所有 .properties 文件加入配置, 如果 resursion 属性设置为 true, 将会 递归加载本目录及所有子目录下的 .properties 文件, 目前仅支持 * 通配符, 以后可以考虑加上正则表达式支持 请参见 http://jira.opensymphony.com/browse/WW-809 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- ExpressionConfigurationSupportListener use to register the ExpressionConfigurationSupport impl for Configuration, you must declare the ServletContext Init Parameter INIT_PARAMETER_NAME, and it's value must in allowableParaeterValues, otherwise the listener will do nothing, and this listener's declaration must before com.opensymphony.xwork.spring.SpringObjectFactoryListener. You can config it like this in web.xml: <context-param> <param-name>webwork.expressionConfigurationSupport.resursion</param-name> <param-value>false</param-value> </context-param> <listener> <listener-class>org.summerfragrance.web.util.webwork.ExpressionConfigurationSupportListener</listener-class> </listener> -------------------------------------------------------------------------------------------------------------------------------------------------------------------- ExpressionConfigurationSupport provide a strong and convenient solution for webwork's "webwork.custom.i18n.resources" and "webwork.custom.properties" 's config, it can replace the default impl DefaultConfiguration, it has three strongpoints rather than the default impl : * Wildcard Charachter Config Support (Later may be add Regex support). * Resursion Support. * White Space Support. 1. Designation all propertiy files in some package with a wildcard character You can define the "webwork.custom.i18n.resources " or "webwork.custom.properties" like this : webwork.custom.i18n.resources = ApplicationResources, org/summerfragrance/security/web/webwork/* Then all ".properties" files will be added to webwork's configuration. 2. Resursion Support If you set the resursion attribute to "true", all property files in the package you specified and all it's sub-package will be added to webwork's configuration. 3. White Space Support As we know, the default impl DefaultConfiguration doesn't support white space between multi config files, so I add this :) 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |