Does Spring MVC support extension-less URLs like asp.net MVC does?
I am just getting started with Spring MVC.
Or maybe has nothing to do with Spring MVC but Tomcat?
Does Spring MVC support extension-less URLs like asp.net MVC does?
I am just getting started with Spring MVC.
Or maybe has nothing to do with Spring MVC but Tomcat?
Yes, it does.
If you are using annotations, you annotate your controller methods or classes with something like:
@RequestMapping("/hello")
Which will respond to /hello
when you map the dispatcher servlet like so:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
You must set this in your /WEB-INF/web.xml:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
(assuming your DispatcherServlet is named "dispatcher").