web.xml
the problem is in url pattern of servlet-mapping.
/DispatcherServlet
let's say our controller is
@Controller
public class HomeController {
@RequestMapping("/home")
public String home(){
return "home";
}
}
when we hit some URL on our browser. the dispatcher servlet will try to map this url.
the url pattern of our serlvet currently is /Dispatcher which means resources are served from {contextpath}/Dispatcher
but when we request http://localhost:8080/home we are actually asking resources from / which is not available.
so either we need to say dispatcher servlet to serve from / by doing
/
our make it serve from /Dispatcher by doing /Dispatcher/*
E.g
springsecuritydemo
offers
offers
org.springframework.web.servlet.DispatcherServlet
1
offers
/Dispatcher/*
and request it with http://localhost:8080/Dispatcher/home
or put just / to request like
http://localhost:8080/home