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

        <bdo id='njZYO'></bdo><ul id='njZYO'></ul>

      1. <small id='njZYO'></small><noframes id='njZYO'>

        <legend id='njZYO'><style id='njZYO'><dir id='njZYO'><q id='njZYO'></q></dir></style></legend>

        找不到请求的页面或方法时如何定义全局页面?

        时间:2023-09-25
        • <small id='iw0dE'></small><noframes id='iw0dE'>

                <tbody id='iw0dE'></tbody>
              <legend id='iw0dE'><style id='iw0dE'><dir id='iw0dE'><q id='iw0dE'></q></dir></style></legend>
                • <bdo id='iw0dE'></bdo><ul id='iw0dE'></ul>
                • <tfoot id='iw0dE'></tfoot>

                  <i id='iw0dE'><tr id='iw0dE'><dt id='iw0dE'><q id='iw0dE'><span id='iw0dE'><b id='iw0dE'><form id='iw0dE'><ins id='iw0dE'></ins><ul id='iw0dE'></ul><sub id='iw0dE'></sub></form><legend id='iw0dE'></legend><bdo id='iw0dE'><pre id='iw0dE'><center id='iw0dE'></center></pre></bdo></b><th id='iw0dE'></th></span></q></dt></tr></i><div id='iw0dE'><tfoot id='iw0dE'></tfoot><dl id='iw0dE'><fieldset id='iw0dE'></fieldset></dl></div>
                  本文介绍了找不到请求的页面或方法时如何定义全局页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道如何在遇到异常时在我们定义的包中调整全局错误重定向页面,只需在 struts.xml 的父包中添加以下配置:

                  I know how to fine a global error redirect page in our defined package when exception encountered that just by adding the following configuration in the parent package in struts.xml:

                  <global-results>
                      <result name="error">/error.jsp</result>
                  </global-results>
                  
                  <global-exception-mappings>
                      <exception-mapping exception="java.lang.Exception" result="error" />
                  </global-exception-mappings>
                  

                  但是好像无法捕捉到请求的资源、方法、页面未找到等异常,我的意思是如何捕捉struts2级别的错误,然后我可以做点什么来处理.

                  But It seems to not able to catch those exceptions like requested resources, methods, pages are not found, I mean how to catch the struts2-level errors, and then I can do something to handle it.

                  推荐答案

                  您应该在 struts.xml 中定义您的未知处理程序.当执行未知的操作、结果或方法时,框架会调用未知的处理程序.

                  You should define your unknown handler in the struts.xml. Unknown handlers are called by the framework, when an unknown action, result, or method are executed.

                  <bean type="com.opensymphony.xwork2.UnknownHandler" name="handler" class="com.package.SomeUnknownHandler"/> 
                  

                  该类应该实现UknownHandler接口来处理这些情况:

                  The class should implement UknownHandler interface to handle the cases:

                  • 当动作配置未知时
                  • 当找不到操作和结果代码的结果时
                  • 找不到操作方法时

                  这篇关于找不到请求的页面或方法时如何定义全局页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用值“[Ljava.lang.String;@10dd65e"设置表达式“spa.amount"时 下一篇:动作映射中的错误 URL 匹配

                  相关文章

                  <small id='YFkQm'></small><noframes id='YFkQm'>

                  1. <tfoot id='YFkQm'></tfoot>
                        <bdo id='YFkQm'></bdo><ul id='YFkQm'></ul>
                    1. <legend id='YFkQm'><style id='YFkQm'><dir id='YFkQm'><q id='YFkQm'></q></dir></style></legend>
                    2. <i id='YFkQm'><tr id='YFkQm'><dt id='YFkQm'><q id='YFkQm'><span id='YFkQm'><b id='YFkQm'><form id='YFkQm'><ins id='YFkQm'></ins><ul id='YFkQm'></ul><sub id='YFkQm'></sub></form><legend id='YFkQm'></legend><bdo id='YFkQm'><pre id='YFkQm'><center id='YFkQm'></center></pre></bdo></b><th id='YFkQm'></th></span></q></dt></tr></i><div id='YFkQm'><tfoot id='YFkQm'></tfoot><dl id='YFkQm'><fieldset id='YFkQm'></fieldset></dl></div>