Say, i have a Spring MVC application with the following web.xml entry:
<error-page>
<error-code>404</error-code>
<location>/error/404</location>
</error-page>
and following error-page controller:
@RequestMapping({"","/"})
@Controller
public class RootController {
@RequestMapping("error/{errorId}")
public String errorPage(@PathVariable Integer errorId, Model model) {
model.addAttribute("errorId",errorId);
return "root/error.tile";
}
}
Now user requested non-existent URL /user/show/iamnotauser which triggered error page controller. How do i get this non-existent '/user/show/iamnotauser' URL from errorPage() method of RootController to put it into model and display on error page ?