Pages

Monday, September 2, 2013

Error 404 Not Found when calling url without file extension in SpringMVC

If you are new to web frameworks and trying some sample programs available in the net, you might face this error at initial stages.



If you try the same with the extension, it will work:

/testMVC/index.htm OR /testMVC/index.jsp

In this scenario, have a look at the  in web.xml. If the url pattern is something like



<url-pattern>*.htm</url-pattern> OR <url-pattern>*.jsp</url-pattern>

you might need to do a change to make it working without the extension.

If you want to make sure it works without the extension, you need to change in the web.xml as follows:
Wondering what is the change? We are telling Spring servlet to take care of all url patterns. So all the requests will be handled by Spring. When you do this fix and make it working, you might encounter another issue which we'll see in the next post. Look forward to solve the issue: Unable to load external CSS file in SpringMVC

No comments:

Post a Comment