Declarative Exception Handling
- The login() method in the SecurityService class may
throw an InvalidLoginException
- However, this method is not protected
by an enclosing try-catch
- This is permissible since the enclosing
execute() method is declared to throw a general Exception
- How does Struts know what to do with an InvalidLoginException?
- Consults the
global-exceptions
element in struts-config.xml
- This element specifies the property
name (attribute key) under which to find an error message in the
resource bundle