I have below config in web.xml
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/mvc-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
I have controller as below.
@Controller
public class SomeController {
@RequestMapping("/somePath")
public String showExtendedUi() {
return "somePage";
}
}
Now client would call the controller by sending url params as belo:
http://localhost:8080/myApp/somePath?param1=456¶m2=456
But the controller method is not being called.
Is my URL correct?
As the URL pattern for Dispatcher Servlet is configured as *.do, The controller would be called only only by url requests of pattern "something.do".
so your url
http://localhost:8080/myApp/somePath.do?param1=456¶m2=456
would work if all other configurations are made properly.Your controller method is not being invoked because you have mapped
mvc-dispatcher
to*.do
Change servlet mapping to