trs
trs

Reputation: 2454

java struts global exception handling

I am trying to implement global exception handling in a struts.xml file. My struts.xml file is set up like this:

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

How should I nest the global exception mapping and global results elements in this file?

Upvotes: 0

Views: 761

Answers (1)

Nickmancol
Nickmancol

Reputation: 1044

In the S2 docs it's the answer:

<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>

Upvotes: 1

Related Questions