formatted according to eugen's formatter.
This commit is contained in:
parent
d100f84ea9
commit
1c13d2ccf9
@ -2,6 +2,7 @@ package com.baeldung.spring.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.http.converter.xml.MarshallingHttpMessageConverter;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -16,7 +17,7 @@ public class ErrorController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "errors", method = RequestMethod.GET)
|
||||
public ModelAndView renderErrorPages(HttpServletRequest httpRequest) {
|
||||
public ModelAndView renderErrorPage(HttpServletRequest httpRequest) {
|
||||
ModelAndView errorPage = new ModelAndView("errorPage");
|
||||
String errorMsg = "";
|
||||
int httpErrorCode = getErrorCode(httpRequest);
|
||||
@ -46,6 +47,7 @@ public class ErrorController {
|
||||
}
|
||||
|
||||
private int getErrorCode(HttpServletRequest httpRequest) {
|
||||
return (Integer) httpRequest.getAttribute("javax.servlet.error.status_code");
|
||||
return (Integer) httpRequest
|
||||
.getAttribute("javax.servlet.error.status_code");
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
<title>Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
${errorMsg}
|
||||
</h1>
|
||||
<h1>${errorMsg}</h1>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -44,8 +44,6 @@
|
||||
</welcome-file-list>
|
||||
|
||||
<error-page>
|
||||
<location>
|
||||
/errors
|
||||
</location>
|
||||
<location>/errors</location>
|
||||
</error-page>
|
||||
</web-app>
|
Loading…
x
Reference in New Issue
Block a user