When the declarative exception handling was introduced, I was very
concerned about the scope attribute in the ExceptionConfig. It is a
redundant
attribute if we obey the following rules:
1) All exceptions that could reach to the exception handler should be
    fatal errors.
2) Fatal errors should be consumed and/or logged in the current thread.

The ErrorsTag, MessagesTag, and utility classes were correctly
designed to handle request scoped ActionErrors. And the rules are
consistent with the servlet engines' error handling mechanism:
Any system errors will be output and/or logged in the current thread.
Further more, any fatal/system errors from EJB and database must
be reported during one invoking method (also in one thread).
So in 99% use cases, you do not need to store ActionErrors
in the session scope.

If the scope attribute was removed, then some bug reports regarding to
the exception handling would not be there. Forgetting about session
is the *cleanest* solution from my point of view.

If the 1% users REALLY want to store ActionErrors in the session scope,
they could extend the base exception handler class with the following
questions to be answered:

1) When an object is stored in a session, the object should serve some
purposes across request threads. If fatal errors do not get handled
in the current thread and stored in the session, which later request
thread will take care of them?
2) If non-fatal errors are stored in a session and some later request
threads may be interested in the non-fatal errors and make decision
based on them, then consider do the non-fatal *errors* really
qualify as errors? In other words, should they be caught or processed
within the Action.execute() method and stored as business objects?

It is very likely to over kill a problem if session scoped ActionErrors
are used. It only gives you more troubles than problems solved.

Jing
Netspread Carrier
http://www.netspread.com


----- Original Message ----- 
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 03, 2003 1:58 PM
Subject: ExceptionHandler storing ActionErrors in session


> I'm just starting to fiddle around with ExceptionHandlers and was
wondering
> how and when ActionErrors are removed from session scoped if configured to
> be "stored" there.
>
> I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
> these tags would be used to render the ActionErrors) and didn't see
> provisions for removing ActionErrors from session scope.
>
> I must have missed something obvious here and would appreciate anyone who
> could point me in the right direction.
>
> robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to