我正在使用表单验证的Spring 3 MVC应用程序 . 验证正在服务器端进行,但即使我返回BindingResult,当验证失败时,标记也不会显示消息 .
控制器方法:
@RequestMapping(value = "server/{serverId}/save", method = RequestMethod.POST)
public ModelAndView saveServer( @PathVariable long serverId,
@Valid ServerEditor serverEditor,
BindingResult result){
AdminSystemServer server = adminService.loadServer(serverId);
if (!result.hasErrors()){
server.setServerName(serverEditor.getServerName());
server.setServerUrl(serverEditor.getServerUrl());
adminService.save(server);
}
mv.setViewName(".layout.servers.manage.server");
mv.addObject("server", server);
mv.addObject("result", result);
return mv;
}
形式jsp
System Name
我知道验证工作正常,因为我逐步调试并查看绑定结果中的错误,但消息永远不会出现 .
有人有主意吗?