Hi,
I am using @Valid for learning And when using @Valid in controller it's not working (Validation not working)
My form
My controllerPHP Code:import javax.validation.constraints.Size;
public class CommentForm {
@Size(min=4,message="Error")
private String commend;
public String getCommend() {
return commend;
}
public void setCommend(String commend) {
this.commend = commend;
}
}
When submitting form with empty value following code in controller not working. Please help me to find out the pblm.PHP Code:@RequestMapping(method = RequestMethod.POST, value = "/commentsForm")
public String saveCommends(CommentForm commentForm, BindingResult result) {
if (result.hasErrors()) {
return "commentsForms";
}
return return "commentsForms";;
}
PHP Code:if (result.hasErrors()) {
return "commentsForms";
}


Reply With Quote