开发者

Using HandlerExceptionResolver for 404

开发者 https://www.devze.com 2023-01-07 05:51 出处:网络
I wanted to use HandlerExceptionResolver to handle exceptions related to request issues such as 404 and other error codes.Tomcat seems to respond to these errors without looking at Spring.Is there a w

I wanted to use HandlerExceptionResolver to handle exceptions related to request issues such as 404 and other error codes. Tomcat seems to respond to these errors without looking at Spring. Is there a way to make HandlerExceptionResolver respond to 404 errors.

I know that co开发者_如何学运维nfiguring web.xml and using <error-page> will work. But is there a way to do this by registering the HandlerExceptionResolver or something similar to that using Spring MVC?


Exceptions and HTTP Response error codes are two different things. Spring's HandlerExceptionResolver can be used to resolve exceptions but not error codes. web.xml is the best place to handle error codes.

0

精彩评论

暂无评论...
验证码 换一张
取 消