You tagged @ExceptionHandler
eg:
@ExceptionHandler(MyBusinessException.class) public ModelAndView handleMyBusinessException(MyBusinessException e) { handle it or log it or redirect to error page after populating a model }
This has the advantage that Exception is handled at the Spring MVC level, you can populate the model and display a meaningful error page.
Otherwise, you can configure it in web.xml, as another answer suggests. But your error page will look more like a static page.
source share