Far from being an authoritative answer, I'll give only my impressions on this subject. If I am wrong, please anybody correct me.
1) I'd say that an exception declared as global will be caught by
Struts independently of which action (or business logic) it was fired in; declared inside an action, only this specific action would treat (pass the control to the handler);
2)scope here is only the context used to look for the ActionError object, and I think we can use request scope in both global and local exceptions.
3) Exceptions have the "key" parameter that you can use to send a message to the view. But you can always use ActionError. Of course that if all you need is to to send messages to the
jsp (without any other more elaborate processing) maybe you could get along without exceptions in the first place and use only ActionError (or ActionMessage).
4) this is the "declarative" way of treating exceptions in struts. So it spares you from writing try/catch blocks. So
you should choose one way: either declare your exceptions in the struts-config or write explicit code (try/catch) in in your actions.
Hope it helps and please tell me if there is any false reasoning.
Kaiser
Originally posted by Artemesia Lakener:
1. what's the difference between <global-exception> and "local exception" (defined inside the <action> tag) ? Doesn't <global-exception> belong to some Actions ? Are they the exceptions that are *not* handled by Action ?
2. For <global-exception> should I always define the scope to "session" ? I guess "scope=request" won't work because it won't carry it all the way down. Right ?
3. If an exception is declared in the struts-config.xml, do I still have to write code like "ActionErrors erros = new ActionError(..); errors.add(new ..)" kind stuff ?
4. Is it true that if an exception IS caught and handled specifically in an Action, then it should *not* be declared in struts-config.xml any more (no matter global or local exception) ?