I’m new to spring MVC. My problem is that @PathVariable causes 404 “The requested resource () is not available“.
For example this works fine for URL http://localhost:8080/Spring/list
@RequestMapping(value = "/list")
public String list() {
return "WEB-INF/views/list.jsp";
}
But this return 404 for url http://localhost:8080/Spring/list/foo
@RequestMapping(value = "/list/{nameId}")
public String list(@PathVariable("nameId") String nameId) {
return "WEB-INF/views/list.jsp";
}
What is wrong? Thanks for your answers
The error message says it all. Since it’s a hierarchical path it’s looking in
/list/WEB-INF/etc...; try an absolute path to the JSP to avoid that issue.It’s a bit counter-intuitive, I suppose.