报错内容为:
其中有一段话为:[quote]In this case, use RequestContextListener or RequestContextFilter to expose the current request.
[/quote]
然后参考了Spring Framework 2.0.5 API 文档英文版[url]http://doc.javanb.com/spring-framework-api-2-0-5/org/springframework/web/context/request/RequestContextListener.html[/url] 才知道项目里的web.xml中没有配置RequestContextListener,则在web.xml中加入下面内容则正常运行了。
Unable to instantiate Action, testAction, defined for 'testStart' in namespace '/TEST'Error creating bean with name 'testAction': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
其中有一段话为:[quote]In this case, use RequestContextListener or RequestContextFilter to expose the current request.
[/quote]
然后参考了Spring Framework 2.0.5 API 文档英文版[url]http://doc.javanb.com/spring-framework-api-2-0-5/org/springframework/web/context/request/RequestContextListener.html[/url] 才知道项目里的web.xml中没有配置RequestContextListener,则在web.xml中加入下面内容则正常运行了。
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>