With the web.xml configured they way you have in the question, in particular:
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.
The simplest way to solve is to have your servlet url mapping as follows:
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 is not consulted, and your servlet container's default servlet will service the request and present the jsp as expected.
Hope this helps, I realize your earlier comments state that the problem has been resolved, but the solution CAN NOT be just adding method=RequestMethod.GET to the RequestMethod.
I think Spring's documentation is partly responsible for this confusion. They use this web.xml piece <servlet-mapping> <servlet-name>example</servlet-name> <url-pattern>/example/*</url-pattern> </servlet-mapping> as an example, without any warning that the resolved views might go back to the dispatcher again if servlet mapping is not carefully configured. Most people would just remove the example part and that's how they got this strange problem.
You're a god and I am not and I just thought that you should know.
You are too kind @asteri
what if I want .json to be served by the dispatcher servlet. do I have to explicitly map the url pattern?
@TharinduVishwanath yes, you will need a url pattern if you want .json requests to be served by dispatcher servlet