jquery的验证器和spring mvc的验证器

springmvc的验证器

 <tr> <td>Name:</td> <td><input type="text" th:field="*{name}" /></td> <td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td> </tr>

指定验证的位置


jquery的验证器

<script>
$(document).ready(function() {  
    $("#inputForm").validate({  
        rules : {  
                name:{  
                    required:true,  
                    minlength:"3"     
                },    
                password:{  
                    minlength:"3"     
                },    
                passwordConfirm:{  
                    equalTo : "#password"  
                },  
                email:{  
                    required:true,  
                    email:true    
                }         
        },  
        messages : {  
  
        }  
    });  
});  
</script> 



参考

1

http://spring.io/guides/gs/validating-form-input/

2

http://jeromejaglale.com/doc/spring4_tutorial/form_validation

3

http://jeromejaglale.com/doc/java/spring/form_validation

4

http://blog.csdn.net/yyzhq/article/details/8055038

5

http://jqueryvalidation.org/documentation/

在文章5里,提到

Validate forms like you've never validated before!


你可能感兴趣的:(jquery的验证器和spring mvc的验证器)