• <i id='4oMN0'><tr id='4oMN0'><dt id='4oMN0'><q id='4oMN0'><span id='4oMN0'><b id='4oMN0'><form id='4oMN0'><ins id='4oMN0'></ins><ul id='4oMN0'></ul><sub id='4oMN0'></sub></form><legend id='4oMN0'></legend><bdo id='4oMN0'><pre id='4oMN0'><center id='4oMN0'></center></pre></bdo></b><th id='4oMN0'></th></span></q></dt></tr></i><div id='4oMN0'><tfoot id='4oMN0'></tfoot><dl id='4oMN0'><fieldset id='4oMN0'></fieldset></dl></div>

    <small id='4oMN0'></small><noframes id='4oMN0'>

  • <tfoot id='4oMN0'></tfoot>
        <legend id='4oMN0'><style id='4oMN0'><dir id='4oMN0'><q id='4oMN0'></q></dir></style></legend>
          <bdo id='4oMN0'></bdo><ul id='4oMN0'></ul>

        如何在 Struts 2 中捕获默认拦截器堆栈抛出的异常?

        How to catch the exception thrown by default interceptor#39;s stack in Struts 2?(如何在 Struts 2 中捕获默认拦截器堆栈抛出的异常?)

              <tbody id='6TEJT'></tbody>

              1. <tfoot id='6TEJT'></tfoot>
              2. <small id='6TEJT'></small><noframes id='6TEJT'>

                <i id='6TEJT'><tr id='6TEJT'><dt id='6TEJT'><q id='6TEJT'><span id='6TEJT'><b id='6TEJT'><form id='6TEJT'><ins id='6TEJT'></ins><ul id='6TEJT'></ul><sub id='6TEJT'></sub></form><legend id='6TEJT'></legend><bdo id='6TEJT'><pre id='6TEJT'><center id='6TEJT'></center></pre></bdo></b><th id='6TEJT'></th></span></q></dt></tr></i><div id='6TEJT'><tfoot id='6TEJT'></tfoot><dl id='6TEJT'><fieldset id='6TEJT'></fieldset></dl></div>
                <legend id='6TEJT'><style id='6TEJT'><dir id='6TEJT'><q id='6TEJT'></q></dir></style></legend>
                • <bdo id='6TEJT'></bdo><ul id='6TEJT'></ul>
                • 本文介绍了如何在 Struts 2 中捕获默认拦截器堆栈抛出的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Struts 2中如何捕捉默认拦截器堆栈抛出的异常?

                  How to catch the exception thrown by default interceptor's stack in Struts 2?

                  异常消息:

                  There is no action mapped for action name `index`. 
                  

                  如何捕获异常,因为我想定义我的处理方式?

                  How to catch the exception, because I want to define my handling?

                  com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
                      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:58)
                      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
                      org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
                      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                      com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
                      com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:82)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                      org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
                      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                      com.zhanxiao.sys.PermissionFilter.doFilter(PermissionFilter.java:61)
                      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:224)
                      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
                      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
                      org.apache.coyote.http11.AbstractHttp11Processor.proces
                  

                  推荐答案

                  由于请求使用的 URL 未正确映射到操作配置而引发异常.要消除异常,您应该正确地将 URL 映射到操作或使用默认操作引用,如果没有找到给定 URL 的操作,则会调用该引用.

                  The exception is thrown because URL used with the request is not properly mapped to the action configuration. To get rid of the exception you should properly map URL to the action or use default action reference which will be called if no action found for the given URL.

                  您也可以使用通配符映射来映射一堆 URL,即使使用正则表达式模式匹配器也会找到您的操作,或者如果通过提供您的自定义实现来覆盖操作映射器的默认行为没有帮助.

                  You may also use wildcard mapping to map a bunch of URLs even with regex pattern matcher which will find your action or if it doesn't help to override the default behavior of the action mapper by supplying your custom implementation.

                  要处理来自您的操作代码和拦截器堆栈的异常,您可以使用 <代码>异常拦截器在你的动作堆栈上.它将通过全局异常映射帮助您处理什么样的异常,并定义实际处理异常的全局结果.请参阅链接,其中详细解释了如何使用异常处理制作默认包的详细信息和示例.

                  To handle exceptions form your action code and interceptor's stack you can use the exception interceptor on the stack of your action. It will help you what kind of exceptions you want to handle via global exception mapping and define the global results that will actually handle the exception. See the link that explains more in details and examples how to make the default package with exception handling.

                  有一个选项可以扩展拦截器并覆盖文档中也描述的异常处理机制.

                  There's an option to extend the interceptor and override the exception handling mechanism as also described in the docs.

                  这篇关于如何在 Struts 2 中捕获默认拦截器堆栈抛出的异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                    <i id='95GxZ'><tr id='95GxZ'><dt id='95GxZ'><q id='95GxZ'><span id='95GxZ'><b id='95GxZ'><form id='95GxZ'><ins id='95GxZ'></ins><ul id='95GxZ'></ul><sub id='95GxZ'></sub></form><legend id='95GxZ'></legend><bdo id='95GxZ'><pre id='95GxZ'><center id='95GxZ'></center></pre></bdo></b><th id='95GxZ'></th></span></q></dt></tr></i><div id='95GxZ'><tfoot id='95GxZ'></tfoot><dl id='95GxZ'><fieldset id='95GxZ'></fieldset></dl></div>
                  1. <small id='95GxZ'></small><noframes id='95GxZ'>

                    <tfoot id='95GxZ'></tfoot>
                        • <bdo id='95GxZ'></bdo><ul id='95GxZ'></ul>

                              <tbody id='95GxZ'></tbody>
                            <legend id='95GxZ'><style id='95GxZ'><dir id='95GxZ'><q id='95GxZ'></q></dir></style></legend>