Novice User
Novice User

Reputation: 3834

Handle errors using a custom view

I want to handle custom errors like 401, 403, 500 etc in Spring 3.2 application using Filters . I do not want to use the web.xml approach of defining the error pages.

I tried to follow the solution listed at How to handle exceptions thrown while rendering a view in Spring MVC?

But ErrorHandler.handle does not really exist.

How can I use filters to catch all the errors and redirect to different views ?

Upvotes: 0

Views: 69

Answers (1)

geoand
geoand

Reputation: 64099

A good way to handle exceptions in Spring Controllers is using the @ExceptionHanldler @ControllerAdvice annotations. Here is the relevant part of the documentation and here is a tutorial on their usage.

Upvotes: 1

Related Questions