Could not find action or result

时间:2021-09-01 13:12:56

[WARN ] 2013-11-21 14:08:16 :Could not find action or result
There is no Action mapped for namespace [/] and action name [b2bAccOcSearchInput1] associated with context path [/acode]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.frame.action.ChineseFilter.doFilter(ChineseFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

这是一个在开发中经常遇到的异常信息,引起他的原因也多种多样!

通常我是先Ctrl+H先搜索一下(如下图所示)

Could not find action or result

然后从JSP页面---struts配置文件---Action类中的方法---返回struts配置文件---返回页面,逐一的排查看看那里出现了问题!一般情况下是比较容易将此错误轻易解决的,下面是几个常见的引起此异常的类型:

1:action的名字不统一,页面的和struts配置文件中的不一致

2:struts配置文件中包的名称或命名空间的名称定义的和页面中书写的不一致

3:Action类中的返回值和struts配置文件中的不一致

4:如果这些都没问题,dubug一下看看能否走到Action类中的方法中,如果能,try...catch一下看看走到那一句报的错,若果依旧没问题,那就clean一下项目可能是文件没有编译好的缘故,最后一招就是重启系统,重启eclipse到这里,一般问题是能搞定的,如果还搞不定,嘿嘿,就再请教牛人吧!