• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to define global exception in struts ?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Anybody please tell how to define global exception in struts ?

Thanks in advance

harish
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by harish pathak:
Hi All,

Anybody please tell how to define global exception in struts ?

Thanks in advance

harish



Greetings harish,


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

*just my 2cents worth*
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic