Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Struts%20Interview%20Questions%20and%20Answers

Question: Declarative Exception Handling
Answer: If you have developed web applications long enough, you will realize a recurring pattern emerges: when the backend (e.g. the EJB tier) throws you an exception, you nearly always need to display an error page corresponding to the type of that exception. Sooner or later, you will come up with a mechanism to use a lookup table (e.g. an HashMap) to lookup an error page from the exception class.
Struts 1.1 now provides a similar but more powerful mechanism to declare exception handling. In Struts 1.1, you can declare in the struts-config.xml the associations between an exception class and an exception handler. Using the default exception handler included in Struts, you can also specify the path of the error pages. With this information, Struts will automatically forward to the specified pages when an uncaught exception is thrown from an Action.
Like other facilities in Struts, the exception handlers are pluggable. You can write and define your own handler classes if needed. 
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook