-
May 23rd, 2010, 01:41 PM
#1
form:errors
I am using anotated controller and having the following code:
@RequestMapping(value = "/test_form.htm", method = RequestMethod.POST)
public String save_form(@Valid @ModelAttribute AppForm form,
BindingResult errors, ModelMap model)
{
System.out.println(">>" + this.getClass().getName() + ":save_form()");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name",
"error.empty-name");
model.put("AppForm", form);
System.out.println(">>hasErrors?" + errors.hasErrors());
if (errors.hasErrors())
{
for (FieldError error : errors.getFieldErrors())
{
System.out.println(">>" + error.getField());
model.put(error.getField(), error.getDefaultMessage());
}
}
return "test_form";
}
In the jsp page, I have:
<form:errors path="*" cssClass="errorBox" />
But the errors didn't come up event the program prints the errors.
Any help!
-Henry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules