Struts2没有Action映射

时间:2013-10-16 22:01:21

标签: input struts2 action

我正在使用Struts 2.3.15.2。我写了我的行动:

<action name="ricerca" class="com.emaborsa.doctracing.web.action.ricerca.RicercaUtentiAction" method="ricerca">
    <result name="input" type="tiles">utente.ricerca.def</result>
    <result name="success" type="tiles">utente.elenco.def</result>
</action>

如果在网址中我拨打localhost:8080/myProject/ricerca.action就行了。如果我打电话给localhost:8080/myProject/ricerca!input.action,它会抛出我的:

  

2013-10-16 23:49:50,602错误[org.apache.struts2.dispatcher.Dispatcher] [http-bio-8080-exec-8]处理请求期间发生异常:没有针对命名空间映射的Action [ / utente]和与上下文路径[/ myProject]相关联的动作名称[ricerca!input]。   对于与上下文路径[/ myProject]关联的名称空间[/ utente]和操作名称[ricerca!input],没有映射的Action。 - [未知位置]       在com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)       在org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)       at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)       在com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)       在org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)       at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)       at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)       在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)       在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)       在org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)       在org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)       在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)       在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)       在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)       在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)       在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)       在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)       at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:589)       at org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:310)       at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(Unknown Source)       at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)       在java.lang.Thread.run(未知来源)

我不明白这是某个设置或其他问题。在较旧版本的struts上它可以工作,但由于瓷砖的不兼容性问题我不得不升级。

2 个答案:

答案 0 :(得分:2)

尝试在struts.enable.DynamicMethodInvocation = TRUE

中设置struts.xml

答案 1 :(得分:0)

检查struts-config.xml中的命名空间

<package name="example" namespace="/example">

请参阅本书,我们将为您提供指导。

Struts2 in action