Sneha Manohar <sneha_hams...@...> writes:
> Hi All ,
>  
> I am trying to call  error page when SQLException occurs
>  
> I have written my own exception handler 'MyException'  implementing
 ExceptionHandler . Here I am trying to forward it to error page . How do I
throw (call) this MyException from ActionBean. Following code does not work ..it
says we incompatible type ..we need throwable.  Can you please send sample for
handling exception using stripes
>  
> public class RegisterActionBean extends AnoigmaActionBean {
>  
>    public Resolution registerUser() throws MyException {
>          um.saveToDB(this.user,this.getCountryId());        return new
ForwardResolution("/login_step_end.jsp");    }
>  
> }
> 

Hi Sneha,

As the name "ExceptionHandler" already says, its purpose is to handle exceptions
not to be used as an exception. You are trying to "throw" your exception
handler. In Java you can only "throw" subclasses of the Throwable class and is
subclasses, like e.g. Exception or RuntimeException.

public class MyException extends RuntimeException {}

public class MyExceptionHandler implements ExceptionHandler {
   ...
}

and then in your ActionBean:
public Resolution registerUser() throws MyException {
   ...
}

Have a look here, to read about exceptions in Java
http://java.sun.com/docs/books/tutorial/essential/exceptions/

And here how to write and configure your Stripes exception handler:
http://www.stripesframework.org/display/stripes/Exception+Handling

Cheers,
Lars



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to