<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern> </servlet-mapping>
ALL requests being made to your web app will be directed to the DispatcherServlet
. This includes requests like /tasklist/
, /tasklist/some-thing.html
, /tasklist/WEB-INF/views/index.jsp
.
Because of this, when your controller returns a view that points to a .jsp
, instead of allowing your server container to service the request, the DispatcherServlet
jumps in and starts looking for a controller that can service this request, it doesn't find any and hence the 404
.
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern> </servlet-mapping>
Notice the missing *
. This tells the container that any request that does not have a path info
in it (urls without a .xxx at the end), should be sent to the DispatcherServlet
. With this configuration, when a xxx.jsp
request is received, the DispatcherServlet
s not consulted, and your servlet container's default servlet will service the request and present the jsp as expected.