Same argument from me as to why this is a bad approach in ww2. It's reinventing an existing wheel. Sure, it's maybe a bit more convenient to use than the built-in mechanism in the servlet container, but it's still stepping on its toes and making things that little bit murkier.

Joseph Ottinger wrote:

A client of mine has been trying out WW1.3 and the exception handling
around execute() yielded a question and suggestion. The issue is that
throwing exceptions either bubbles up to the webapp layer, or involves a
pattern where a common ActionSupport derivative wraps a method call in
various try/catch blocks in an attempt to control routing of the
exception.

Using the servlet container's exception handling is workable, but ugly,
especially in the case where a common exception can be thrown. The pattern
where a "process()" method is wrapped is better, but not by much.

What I'd thought of was adding an extra method to Action and
ActionSupport. The Action method's signature might look like this:

public String handleException(Throwable t) throws Throwable;

The ActionSupport implementation:

public String handleException(Throwable t) throws Throwable {
        throw t;
}

What would happen is that the invoker, in a try/catch, would call
handleException() to "handle" any exceptions. The default behaviour would
be to re-throw the exception, which would yield the exact same behaviour
WebWork has today.

However... you could ALSO override handleException() to add an error to
the error array, and return INPUT (or ERROR, or whatever) instead, which
would allow an action hierarchy to easily compartmentalize exception
handling, without FORCING an application to do so.

Thoughts? Insults? Points?

-------------------------------------------------------------------
Joseph B. Ottinger                         http://enigmastation.com
IT Consultant                                [EMAIL PROTECTED]
J2EE Editor - Java Developer's Journal   [EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to