我们正在使用Struts2-Spring集成,我的所有操作类都实现了ServletRequestAware,ServletResponseAware。
我的应用程序上下文我给了aop:scope-proxy。
bean id="userAction"
scope="request"
parent="baseAction"
class="com.test.user.controller.UserAction"
aop:scoped-proxy/
我还在web.xml中添加了监听器 org.springframework.web.context.request.RequestContextListener
但我的实例变量似乎在使用Request范围时出现问题(可能为null)并且抱怨下面的异常。我也是对我的pom.xml的CGLIB依赖 因为它是
Caught an exception while evaluating expression
'#userAction == 'display'' against value stack
java.lang.IllegalArgumentException: invalid comparison: com.test.user.controller.UserAction$$EnhancerByCGLIB$$b0795af1 and java.lang.String
at ognl.OgnlOps.compareWithConversion(OgnlOps.java:93)
at ognl.OgnlOps.isEqual(OgnlOps.java:142)
at ognl.OgnlOps.equal(OgnlOps.java:533)
at ognl.ASTEq.getValueBody(ASTEq.java:51)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.Ognl.getValue(Ognl.java:333)
at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:217)
at com.opensymphony.xwork2.ognl.OgnlValueStack.getValue(OgnlValueStack.java:342)
at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValue(OgnlValueStack.java:331)
at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValueWhenExpressionIsNotNull(OgnlValueStack.java:307)
at com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:293)
at org.apache.struts2.components.Component.findValue(Component.java:382)
at org.apache.struts2.components.ElseIf.start(ElseIf.java:83)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:53)