当前位置: 动力学知识库 > 问答 > 编程问答 >

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???

网友答案:

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>
分享给朋友:
您可能感兴趣的文章:
随机阅读: