On 6/28/07, Javed <[EMAIL PROTECTED]> wrote:


I have created one custom Exception class which will be thrown from pages
or
panel when particular entity say "ABC" is deleted from DB. That means,
before performing any operation related to that entity; first it will
check
if that entity exists or not. If that entity no longer exist then it will
through custom exception.
When this exception occurs I am redirecting it to my Error page.

For this I have added following piece of code to Application page.
@Override
    protected IRequestCycleFactory getDefaultRequestCycleFactory() {
        return new IRequestCycleFactory(){
            /**
             * Serial Version UID
             */
            private static final long serialVersionUID = 1L;

            public RequestCycle newRequestCycle(wicket.Session session,
Request request, Response response) {
                return new

WebRequestCycle((WebSession)session,(WebRequest)request,(WebResponse)response){

                    @Override
                    public Page onRuntimeException(Page page,
RuntimeException exception) {
                        if(exception instanceof CustomEntityException){
                            return new MyErrorPage();
                        }
                        return super.onRuntimeException(page, exception);
                    }
                };
            }

        };
    }

This works fine in case of "AjaxLink" but not in case of "Link"

Am I missing something for this implementation to work for "Link"?
Is there any other option to meet this requirement?


set a breakpoint and make sure your if clause is getting hit. the exception
might get wrapped in another, so you might have to search for root cause and
do instanceof on that.

-igor



--
View this message in context:
http://www.nabble.com/Custom-Exception-in-onClick-of-Link-tf3993262.html#a11339624
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to