Viktoriia
Viktoriia

Reputation: 2400

How to get error message in html page from server

I have some problems with error handling in spring mvc web-application. I made a custom html page (note, not jsp) and I'd like to make it something like a universal page that will be able to show error message(thrown by server). I've seen some decisions of this problem with jsp, but I'd like to work with html. Can anybody help me with it? What type of error handling from spring mvc have I use? Thanks.

Upvotes: 1

Views: 755

Answers (1)

rocky
rocky

Reputation: 5004

well, if you you really want to solve it by showing different html pages, then you can customize it using ExceptionHandler annotation on method which return different html page for each exception.

example:

@ExceptionHandler(value = Throwable.class)
public String exceptionHandler(Throwable ex) {
    ...
    return "pathtoYourHtml.html";
}

Upvotes: 1

Related Questions