Sorry for the late reply, I have been away for a few days. Not catching exceptions thrown from onUpdate is fine by me. However i noticed in your code fragment onUpdate always gets called even after an exception occurs. I don't think that should happen. Either onUpdate or onError should be called after the updateModel but not both. The following could work for me (not tested off course ;))
/** * * @see wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) */ protected final void onEvent(final AjaxRequestTarget target) { final FormComponent formComponent = getFormComponent(); boolean error =false; try { formComponent.inputChanged(); formComponent.validate(); if (formComponent.hasErrorMessage()) { formComponent.invalid (); } else { formComponent.valid(); formComponent.updateModel(); } } catch (RuntimeException e) { error=true; onError(target, e); } if(!error) onUpdate(target); } On 6/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > what do you thin about doing it this way? > > I dont know if the onerror() should be invoked if an exception is thrown > from onupdate(), i think the user has to do his own exception there. > > -Igor > > > /** > * > > * @see > wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) > */ > protected final void onEvent(final AjaxRequestTarget target) > { > final FormComponent formComponent = getFormComponent(); > try > > { > formComponent.inputChanged(); > formComponent.validate(); > if (formComponent.hasErrorMessage()) > { > formComponent.invalid (); > } > else > { > formComponent.valid(); > formComponent.updateModel(); > > } > } > catch (RuntimeException e) > { > onError(target, e); > } > onUpdate(target); > > } > > > On 6/1/06, Maurice Marrink < [EMAIL PROTECTED]> wrote: > > > Hi Igor, > > I recently had the need to enhance your > AjaxFormComponentUpdatingBehavior to customize exception > handling. Its > just a small modification but you might want to include it in the > wicket source. Here's the new OnEvent method and a new abstract method > to be called when an exception occurs. > > Maurice > > > /** > * > * @see > wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) > */ > protected final void onEvent(final AjaxRequestTarget target) > { > final FormComponent formComponent = getFormComponent(); > formComponent.inputChanged(); > formComponent.validate(); > if (formComponent.hasErrorMessage()) > { > formComponent.invalid(); > onUpdate(target); > } > else > { > try > { > formComponent.valid(); > formComponent.updateModel(); > onUpdate(target); > } > catch(RuntimeException e) > { > onError(target, e); > } > } > } > /** > * Listener invoked when an exception occurred during the update of > the components model. > * @param target > */ > protected abstract void onError(AjaxRequestTarget target, Exception > exception); > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > Wicket-develop mailing list > Wicket-develop@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > _______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop