2012-09-14 53 views
0

我想在struts.xml文件中實現全局異常處理。我的struts.xml文件是這樣設置的:java struts全局異常處理

<struts> 
     <constant ..... /> 
      <include ......./> 
</struts> 

我應該如何在此文件中嵌套全局異常映射和全局結果元素?

+3

這是不是一個真正的問題,你有什麼問題? – Jaiwo99

+0

按照[S2配置DTD](http://struts.apache.org/2.3.3/docs/strutsxml-examples.html)和每個例子。 –

回答

1

S2文檔它的答案:

<global-exception-mappings> 
    <exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" result="securityerror" /> 
     <exception-mapping exception="java.lang.Exception" result="error" /> 
</global-exception-mappings> 

<global-results> 
     <result name="securityerror">/securityerror.jsp</result> 
     <result name="error">/error.jsp</result> 
</global-results>