@ControllerAdvice Issues

Using @ControllerAdvice we can create a global exception handler but not sure how to handle the following

1. Throw error and stays in the same page in some cases
2. Throws error and redirect to an error page in some cases

#1 - not sure how it is possible as the page should not be re-loaded fully. The user might have encountered a error on the internal form in a page. We are doing ajax calls.

Software ProgrammerAsked:
Who is Participating?
girionisConnect With a Mentor Commented:
In your @ExceptionHandler simply return a ModelAndView with page samePage.jsp in one case and page errorPage.jsp in another.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.