This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to define global exception in struts ?

 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Anybody please tell how to define global exception in struts ?

Thanks in advance

harish
 
Aaron Ting
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • 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*
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic