我有这个控制器:
...
@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";
}
...
当我将此URL放入浏览器
时,控制器的映射效果很好http://127.0.0.1:7001/devices/accounts/manageaccount.do
然后我有这个jsp
<form method="post" action="saveaccount.do">
</form>
但是当我提交时我得到了这个奇怪的错误
URL: /devices/accounts/saveaccount.do
???error404.error???
答案 0 :(得分:0)
确保web-xml中的servlet映射已配置为处理.do
个请求:
<servlet-mapping>
<servlet-name>yourServletName</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>