Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 使用Spring框架,如何将堆栈跟踪发送到多个错误页面?_Spring Mvc_Exception Handling - Fatal编程技术网

Spring mvc 使用Spring框架,如何将堆栈跟踪发送到多个错误页面?

Spring mvc 使用Spring框架,如何将堆栈跟踪发送到多个错误页面?,spring-mvc,exception-handling,Spring Mvc,Exception Handling,webxml 405 /support/405.jsp 500 /support/500.jsp java.lang.Exception /support/500.jsp java.lang.Throwable /support/500.jsp 如何在多个错误页面中添加例外项和可丢弃项 <error-page> <error-code>405</error-code> <location>/support/405.jsp<

webxml


405
/support/405.jsp
500
/support/500.jsp
java.lang.Exception
/support/500.jsp
java.lang.Throwable
/support/500.jsp
如何在多个错误页面中添加例外项和可丢弃项

 <error-page>
    <error-code>405</error-code>
    <location>/support/405.jsp</location>
  </error-page>

<error-page>
    <error-code>500</error-code>
    <location>/support/500.jsp</location>
  </error-page>

  <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/support/500.jsp</location>
  </error-page>

   <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/support/500.jsp</location>
  </error-page>

405
/support/405.jsp
**


java.lang.Exception
/support/405.jsp
java.lang.Throwable
/support/405.jsp
**


500
/support/500.jsp
java.lang.Exception
/support/500.jsp
java.lang.Throwable
/support/500.jsp

你能澄清一下这个问题吗?是否要(1)将多个异常类型/错误代码映射到单个位置,或(2)将单个异常类型/错误代码映射到多个位置?(1) 是可能的,并且看起来像您已经做的。(2) 不可能。我希望每个错误页面t0都能够抛出其特定的异常。因此,如果点击错误页面500,500可以看到异常显示在其视图中。同样,如果点击错误页面405,405也可以看到异常显示在其视图中。感谢您的回复。您的评论没有意义。您是说用户直接导航到,例如,
/support/500.jsp
?在这种情况下,例外应该从何而来?
 <error-page>
    <error-code>405</error-code>
    <location>/support/405.jsp</location>
  </error-page>
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/support/405.jsp</location>
  </error-page>

   <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/support/405.jsp</location>
  </error-page>
<error-page>
    <error-code>500</error-code>
    <location>/support/500.jsp</location>
  </error-page>

  <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/support/500.jsp</location>
  </error-page>

   <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/support/500.jsp</location>
  </error-page>