On 24 Aug 2004 09:56:14 +0800, Sebastian Ho
<[EMAIL PROTECTED]> wrote:
> Hi
> 
> If I plan to use global exception in struts, how do I actually throw the
> exception in my codes in order for the struts exception to kick in? I am
> little confused here how it works because if I do not catch my
> exceptions, it won't even compile. I am refering to non-runtime
> exception here.
> 
> Sebastian Ho
> 

Which method are you using in your Action classes?  If it is the
perform() method from Struts 1.0, there is no "throws" clause there,
so you will definite get compile errors if you try to throw one. 
Change over to the execute() method (and be sure you're using Struts
1.1, of course), and you will be able to throw any exception that you
like.

Craig


> 
> 
> 
> On Tue, 2004-08-10 at 10:59, Kishore Senji wrote:
> > On Mon, 9 Aug 2004 22:06:51 -0300 (ART), Leandro Melo
> > <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > i'm now starting to deal with exception in my
> > > application.
> > >
> > > So far, i haven't used Struts exception handling
> > > alternatives, so, i'm very new at that.
> > >
> > > After some reading i have a few questions (please mark
> > > True of False on my sentences , naturally comments are
> > > welcome!).
> > >
> > >    * It seems to me that Struts has a very nice way
> > > to deal with Exceptions, and i actually should use
> > > that.
> >
> > True !
> >
> > >
> > >    * Is it nice to have locals exceptions handlers
> > > for my Action, or i should just have a few (or one)
> > > global Exception Handler?
> >
> > True (If required) Having LocalException Handlers will give the
> > functionality of handling a particular exception differently, if
> > required.
> >
> > >
> > >    * When do i need to override ExceptionHandler? I
> > > couldn't figure it out a situation where it's needed
> > > (maybe if i want to do some special logs for every
> > > exceptions??? ).
> > >
> >
> > One scenario might be to handle NestedException, You might override
> > execute(Exception ex, ExceptionConfig config, ActionMapping mapping,
> > ActionForm form, HttpServletRequest request, HttpServletResponse
> > response) method of ExceptionHandler to show error messages for all
> > the exceptiosn.
> >
> > >    * Here's an advice from jakarta: " A common use of
> > > ExceptionHandlers is to configure one for
> > > java.lang.Exception so it's called for any exception
> > > and log the exception to some data store.".
> > >      Is it really a nice strategy???
> > >
> >
> > Well Sure, first a local ExceptionHandler is invoked if found,
> > otherwise, the global
> > ExceptionHandlers are searched, if not, the Exception's superclass are
> > searched in a similar fashion. So, declaring a handler for
> > java.lang.Exception, will always be there for you as a default handler
> > for any type of Exception, if you haven't defined a specific handler
> > for that particular exception.
> >
> >
> > > Well, i think this is it! I'd appreciate some comments.
> > >
> > > =====
> > > _________________________________
> > > Leandro Terra C. Melo
> > > Eng. de Controle e Automação - UFMG
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam protection around
> > > http://mail.yahoo.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > Thanks,
> >
> > Kishore Senji.
> >
> > ---------------------------------------------------------------------
> > 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]
> 
>

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

Reply via email to