这是您收到的错误消息:
找到模糊的映射。无法将“ appController”
bean方法公共java.lang.String映射为it.besmart.controller.AppController.newClient(org.springframework.ui.ModelMap)映射到{[//
new],方法= [POST],params = [], headers = [],consumes = [],produces = [],custom
= []}:已经有’appController’bean方法public java.lang.String
it.besmart.controller.AppController.saveClient(it.besmart.models
.Client,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap)映射。
它告诉您要映射多个方法来处理
POSTURL
/new。如果网络浏览器
POST向URL 发出请求,那么
/new您应该使用哪种方法处理该请求?
这是两种令人反感的方法:
@RequestMapping(value = {"/new"}, method = RequestMethod.POST) public String newClient(ModelMap model){ Client client = new Client(); model.addAttribute("client", client); model.addAttribute("edit", false); return "registration"; } @RequestMapping(value = {"/new"}, method = RequestMethod.POST) public String saveClient(@Valid Client client, BindingResult result, ModelMap model){ if(result.hasErrors()){ return "registration"; } clientService.saveClient(client); model.addAttribute("success", "Client" + client.getNomeClient() + "registrato correttamente"); return "success"; }我怀疑其中第一个是不正确的。您可能想要使用
RequestMethod.GET代替
RequestMethod.POST。



