Also, could someone explain how Struts operates when more than one exception handler is provided? And how it works with exception super classes?

Does it search in order to find the first matching exception handler? Or the closest in the hierarchy?

I really like the declarative exception handling capability - a nice feature!

Thanks,
Erik


[EMAIL PROTECTED] wrote:
dgraham 2002/10/20 13:01:06

Modified: doc/userGuide building_controller.xml
Log:
Added info on ExceptionHandler.
Revision Changes Path
1.37 +21 -1 jakarta-struts/doc/userGuide/building_controller.xml
Index: building_controller.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/userGuide/building_controller.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- building_controller.xml 20 Oct 2002 19:48:15 -0000 1.36
+++ building_controller.xml 20 Oct 2002 20:01:06 -0000 1.37
@@ -410,7 +410,27 @@
</section>
<section name="4.4.2 Exception Handler" href="exception_handler">
- <p>[:TODO:]</p>
+ <p>
+ You can define an ExceptionHandler to execute when an Action's execute + method throws an Exception. First, you need to subclass + org.apache.struts.action.ExceptionHandler and override the execute method.
+ Your execute method should process the Exception and return an ActionForward
+ object to tell Struts where to forward to next. Then you configure your + handler in struts-config.xml like this:<br/>
+ <pre>
+ <global-exceptions>
+ <exception key="some.key" type="java.io.IOException" handler="com.yourcorp.ExceptionHandler"/>
+ </global-exceptions>
+ </pre>
+ <br/>
+ That configuration says that com.yourcorp.ExceptionHandler.execute() will be called + when any IOException is thrown by an Action. The key is a key from your message resources
+ properties file that can be used to display an error message.
+ </p>
+ <p>
+ A common use of ExceptionHandler's is to configure one for java.lang.Exception so it's called
+ for any exception and log the exception to some data store.
+ </p>
</section>
<section name="4.4.3 PlugIn Classes" href="plugin_classes">
--
To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to