Yes. For others who don't want to log the exception, you can show error pages for different categories of exceptions by setting these methods on ApplicationSettings:
- getAccessDeniedPage() - getInternalErrorPage() - getPageExpiredPage() Unfortunately, you don't get the exception object there. Perhaps in some near-future version, we can have an error page factory. I think that would be good because then you don't need to get involved in the guts of Wicket to do something pretty simple. How about this: public interface IErrorPageFactory { Page newAccessDeniedPage(AuthorizationException e); Page newPageExpiredPage(PageExpiredException e); Page newExceptionErrorPage(RuntimeException e); Page newInternalErrorPage(RuntimeException e); } then make a default implementation so people can override just the pages they want to customize: public class AbstractErrorPageFactory implements IErrorPageFactory { ... } This would give users the ability to customize without the need to know details like what's in AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle requestCycle) most of which really is necessary to do handle exceptions right. Maybe some developer on the core team would like to handle this? If so, we could remove a number of annoyingly non-general settings from ApplicationSettings in favor of just getErrorPageFactory() Jean-Baptiste Quenot-3 wrote: > > * tooy li(Gmail): > >> I want to create a custom page to catch all error , log these >> into db and only show some clear infomation into user. i know >> set something in the application, but how can i catch these >> error in my page? > > So you want to handle the exception yourself? Try this in your > Application: > > @Override > protected IRequestCycleProcessor newRequestCycleProcessor() { > return new WebRequestCycleProcessor() { > @Override > protected Page onRuntimeException(Page page, RuntimeException > e) { > logErrorInDataBase(e); > return new MyExceptionPage(); > } > }; > } > > You don't indicate which version of Wicket you're using, I assume > the latest in this code snippet. > -- > Jean-Baptiste Quenot > aka John Banana Qwerty > http://caraldi.com/jbq/ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/How-to-catch-the-error-in-custome-error-page--tf3456980.html#a9646011 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user