springMVC中使用spring的form标签库,edit.jsp代码如下:jspFullname:Username:Nospaces,Please.Password:6charactersormore.EmailAddress:Incaseyouforgetsomething.Sendmeemailupdates!控制器的代码如下:java@RequestMapping(method=RequestMethod.GET,params="new")publicStringcreateSpitterProfile(Modelmodel){model.addAttribute(newSpitter());return"spitters/edit";}@RequestMapping(method=RequestMethod.POST)publicStringaddSpitterFromForm(@Valid@ModelAttribute("spitter")Spitterspitter,BindingResultbindingResult){if(bindingResult.hasErrors()){return"spitters/edit";}spitterService.saveSpitter(spitter);return"redirect:/spitter/"+spitter.getName();}在jsp的语句中,如果enctype=application/x-www-form-urlencoded则运行正常;如果调成multipart/form-data后,提交表单时不管用户名写的是什么,转到的网页后面显示的用户名都是null。请问这是怎么回事?
添加回答
举报
0/150
提交
取消