我有一个这样的jsp页面:
<form:form action="userRegistration" name="userRegistrationForm" commandName="userRegistration">
<form:input path="userName"/>
<form:input path="houseNo"/>
</form:form>
以及所有必填字段。
在控制器中我这样使用:
@RequestMapping(method=RequestMethod.GET)
public String registration(ModelMap model,HttpSession session) {
UserRegistration userRegistration = service.createUserRegistration();
model.addAttribute("userRegistration",userRegistration);
return "registrationview";
}
@RequestMapping(method=RequestMethod.POST)
public String getRegistration(UserRegistration userRegistration, HttpSession session, ModelMap model) {
boolean result = validateAndSaveData(userRegistration);
if (result){
}
}
当用户提交表单时,它会来到帖子,然后验证输入并保存它。如何向视图发送成功消息和错误消息。现有实施中是否需要进行任何更改?