关闭Struts2中的OGNL警告

编程入门 行业动态 更新时间:2024-10-27 07:17:54
本文介绍了关闭Struts2中的OGNL警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试关闭以下警告消息

I am trying to turn off the following warning message

OgnlValueStac W com.opensymphony.xwork2.util.loggingmons.CommonsLogger warn Error setting expression '*checkboxidentifyer*' with value '[Ljava.lang.String;@518b518b'

我已尝试将以下内容放入我的 log4j.xml 文件中

I have tried putting the following in my log4j.xml file

<logger name="log4j.logger.apache.struts2" > <level value="ERROR" /> <appender-ref ref="console" /> </logger> <logger name="log4j.logger.opensymphony" > <level value="ERROR" /> <appender-ref ref="console" /> </logger> <logger name="ognl.OgnlException" > <level value="ERROR" /> <appender-ref ref="console" /> </logger> <logger name="com.opensymphony.xwork2.util.loggingmons.CommonsLogger" > <level value="ERROR" /> <appender-ref ref="console" /> </logger> <logger name="ognl.OgnlRuntime" > <level value="ERROR" /> <appender-ref ref="console" /> </logger>

我也尝试过添加

<constant name="struts.devMode" value="false" />

到我的 struts.xml 文件。此外,我尝试将以下内容添加到 struts.xml 文件的拦截器堆栈部分

to my struts.xml file. Also I have tried adding the following to the interceptor-stack section of the struts.xml file

<interceptor-ref name="defaultStack"> <param name="excludeParams">.*?checkbox.*</param> </interceptor-ref>

我的问题是:1)我是否错过配置? 2)如何禁用警告。

My questions are: 1) Did I do a miss configuration? 2) How do you disable the warnings.

推荐答案

excludeParams 是 params 拦截器,应该像这样引用

The excludeParams is a property of the params interceptor and should be referenced like this

<interceptor-ref name="defaultStack"> <param name="params.excludeParams">.*?checkbox.*</param> </interceptor-ref>

注意,如果你使用 interceptor-ref 操作上的标记然后它会覆盖默认的拦截器堆栈,并且仅适用于此操作配置。对于常见用法,请考虑创建自定义拦截器堆栈并使其成为任何操作配置的默认值。

Note, if you use interceptor-ref tag on the action then it overrides the default interceptor stack and applicable only to this action config. For common usage consider creating a custom interceptor stack and make it default for any action configuration.

您可以为拦截器和OGNL设置日志记录级别。使用 log4j.properties

You can set a logging level for interceptors and OGNL. Using log4j.properties

log4j.logger.opensymphony.xwork2.interceptor=ERROR log4j.logger.opensymphony.xwork2.ognl=ERROR

更多推荐

关闭Struts2中的OGNL警告

本文发布于:2023-10-16 06:11:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1496720.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:OGNL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!