spring与struts2整和出现如下错误:
严重: Could notfind action or result
There is no Action mapped fornamespace / and action name userAction. - [unknown location]
atcom.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
atorg.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
atorg.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
atcom.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
atorg.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
atorg.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
atorg.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
atorg.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
atorg.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
atorg.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
atorg.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
atjava.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
atjava.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
atjava.lang.Thread.run(Unknown Source)
解决方法:
在struts.xml配置文件中添加
<constant name="struts.convention.classes.reload"value="true"/>
<!-- 设置Convention插件定位视图资源的根路径 -->
<constant name="struts.convention.result.path"value="/ssh"/>
<!-- 设置默认匹配所有的action(即使没有@action注解) -->
<constant name="struts.convention.action.mapAllMatches"value="true"/>
<constant name="struts.convention.action.name.separator"value=""/>