# Add Exception Dialog Box

Use to register an exception handler in the `struts-config.xml` file. You open the Add Exception dialog box by right-clicking in a `struts-config.xml` file and choosing Struts > Add Exception.

A Struts exception handler lets you declaratively handle exceptions in the `struts-config.xml` file. Instead of solving exceptions in Java code, you can specify the resource that should deal with the exception. You can also specify the message that should be displayed to the user when an exception occurs. You can fine tune exception handling by providing a different solution for each type of exception or you can let all exceptions be handled in the same way.

In the Add Exception dialog box, you set the following properties:

Element | Description
--- | ---
Resource Bundle | Specifies the servlet context attribute for the message resources bundle associated with this handler. The default attribute is the value specified by the string constant declared at `Globals.MESSAGES_KEY`.
Bundle Key | Specifies the name of the key in the resource bundle that identifies the message to be displayed to the user.
Exception Type | Specifies the type of exception that must occur for the exception handler to be used.
Call |
Resource File | Specifies the resource file that will handle the exception. For example, if a JSP page is set as the resource file, Struts will display the specified JSP page when the exception occurs.
Action | Specifies the action that will handle the exception.
Scope | Specifies the scope within which the exception handler is applicable. By default, the exception handler is set to Session scope.
Location |
Global | Specifies that the exception handler applies to all actions.
Action | Specifies the specific action to which the exception handler applies.

Note: If you want to change a registered exception handler, you can do so by manually editing the XML tags in the `struts-config.xml` file.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.