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)
呵呵~
java