I am confused about the way the DefaultAnnotationHandlerMapping works.
In my web.xml I have
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/somePath/someWork</url-pattern>
<url-pattern>/users</url-pattern>
<url-pattern>/user/*</url-pattern>
</servlet-mapping>
I have the controller like this,
@RequestMapping(value="/user/adduser", method={RequestMethod.POST})
public void addAdmin(@ModelAttribute("myData") myData data) {
System.out.println("We reached adduser controller");
}
And in the jsp file i have
<form:form id="adduser" method="post" action="/user/adduser" commandName="myData">
This does not work. I get the error no handler mapping found for "/adduser" and 404 for the page "/user/adduser"
But in the .xml file if i mention
<url-pattern>/user/adduser</url-pattern>
it works, or if i make the controller like,
@RequestMapping(value="/adduser", method={RequestMethod.POST})
also works. When submitting the page it reaches the correct controller.
I am now confused the way the @ReuqestMapping works. When a request comes like "/user/adduser" from where it will start looking for the right class and the right method?