Anybody please tell how to define global exception in struts ?
Thanks in advance
You could actually define the global exception in Struts through the struts-config.xml
There are several attributes which you have to define in the .xml file.
The files are as follows,
type - Specifies the fully qualified class name of the exception that the handler is for.
path - The page which the config file will redirect the user to when the exception is being thrown.
key - The name of a key in the ApplicationResources.properties file that will be used to populate an ActionError object that will be passed to the page with association to the path attribute.
For example, i have an exeception class, AaronException, a key in my ApplicationResources.properties known as error.AaronException and a JSP page, aaron.jsp, the sample code configuration in struts-config.xml will goes,
P.S.: You could also handle exceptions within the action-mappings...