On Wed, Feb 19, 2003 at 05:04:23PM +0100, Rickard Öberg wrote:
> Anders Engström wrote:
> >This is a functionality I miss in WW a lot. You can only specify views
> >based on success, error, input etc (please correct me if I'm wrong). 
> >- but it would be very nice if you could select view based on Exception 
> >or user-defined return-values:
> <snip>
> 
> The idea is that if an exception is thrown from execute() it's a system 
> exception and not an application exception. I.e. you're supposed to 
> catch all application exceptions and return some view string that 
> corresponds to the error message to be shown.
> 

That sounds resonable, when you put it that way. Am I correct in my
assumption that you can return your own 'result' from an action - it
doesn't have to be 'error', 'success' etc. to map the result 
string to a view?

About exceptions - Looking at GenericDispatcher is seems that
RuntimeException & Co are never trapped when thrown from
Action.execute() (in GenericDispatcher.executeAction()). 

try
{
        result = action.execute();
} catch(Exception e)
{
        actionException = e;
        return;
}

If a RuntimeException is thrown in Action.execute() it will propagate
all the way up to the caller (if using WW in a servlet container, the
servlet container would handle the Throwable - and ServletDispatcher's
pretty error page will not be shown).

Is this the way it is supposed to work - or should GenericDispatcher and
ActionResult actually handle Throwable instead of Exception?


//Anders


Attachment: msg01878/pgp00000.pgp
Description: PGP signature

Reply via email to