<%--Js代码--%>
<script language="javascript" src="../js/jquery.min.js"></script>
<script language="javascript" src="../js/jquery.validate.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#form1").validate(
{
rules:{
name:{required:true,minlength:5,maxlength:30},
email:{required:true,email:true}
}
messages:{
name:{required:"not null!",minlength:"length is not less!",maxlength:"length is not long":},
email:{required:"not null!",email:"email format is wrong!"}
}
});
});
</script>
<%--jsp页面代码--%>
<form action="login.action" method="post" id="form1">
<input type="text" name="name"/>
<input type="text" name="email"/>
<input type="submit" value="Ok">
</form>
我是新手,请大家多多指教!
错误原因:他说缺少对象,应该不会呀,还有就是没有起到验证的效果,直接就跳转