struts2配置文件如下:
<result name="logoutlist" type="redirectAction">
<param name="actionName">list</param>
<param name="namespace">/main</param>
<param name="blogId">${blogId}</param>
<param name="supressEmptyParameters">true</param>
</result>
运行时后台出现了如下错误,但是前台运行结果正常显示:
2011-04-04 19:37:44,734 ERROR [com.opensymphony.xwork2.ObjectFactory] - Unable to set parameter [blogId] in result of type [org.apache.struts2.dispatcher.ServletActionRedirectResult]
Caught OgnlException while setting property 'blogId' on type 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. - Class: ognl.ObjectPropertyAccessor
File: ObjectPropertyAccessor.java
Method: setProperty
Line: 132 - ognl/ObjectPropertyAccessor.java:132:-1
at com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:392)
at com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:143)
at com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflectionProvider.java:91)……
查看了一下两个action的blogId的get/set方法都设置了,但是还是出现了这个问题
把ognl表达式去掉直接传常量,同样出现这样的问题(所以我感觉不是ognl表达式的问题),到网上查了查,结果是:
You can ignore the exception(yeah I know it smells to the moon), or
increase the log level for the ObjectFactory, it is a bug in Struts
which was re-introduced in 2.1.6 (/facepalm)
呵呵~
转载于:https://blog.51cto.com/yin123/535204