Search code examples
springspring-mvcurl-mapping

No mapping found for HTTP request with URI - in spring 3.2.4


I have this controller:

...
    @RequestMapping(value = "/accounts/manageaccount.do", method = RequestMethod.GET)
    public String initForm(HttpServletRequest request, Model model) {

        model.addAllAttributes(getModel(request));

        return "registerAccountView";
    }


    @RequestMapping(value = "/accounts/saveaccount.do", method = RequestMethod.POST)
    public String saveaccount(HttpServletRequest request, Model model) {

        model.addAllAttributes(getModel(request));

        return "registerAccountView";
    }
... 

The controller its mapping well when I put this URL in the browser

http://127.0.0.1:7001/devices/accounts/manageaccount.do

Then I have this jsp

<form method="post" action="saveaccount.do">
</form>

But when I submit I got this strange error

URL: /devices/accounts/saveaccount.do
???error404.error??? 

Solution

  • Make sure the servlet mapping in your web-xml is configured to handle the .do requests :

    <servlet-mapping>
      <servlet-name>yourServletName</servlet-name>
      <url-pattern>*.do</url-pattern>
    </servlet-mapping>