date-rule ="date" 表示格式为yyyy-MM-dd
date-rule = "datetime" 表示格式为yyyy-MM-dd HH:mm:ss
依赖框架在:http://niceue.com/validator/demo/
用法例子:
<tr> <td align="right">扣款金额</td> <td align="left"> <select name="withholdMoney" data-toggle="selectpicker"> <c:forEach items="${withholdStrategyManagerForm.withholdStrategyModuleEnums}" var="withholdStrategy"> <option <c:if test="${withholdStrategy.code eq withholdStrategyManagerForm.withholdMoney}">selected</c:if> value="${withholdStrategy.code}">${withholdStrategy.desc}</option> </c:forEach> </select> <input type="text" data-rule="required; integer; range[1~100]" value="${withholdStrategyManagerForm.withholdMoneyRate}" name="withholdMoneyRate">% </td> </tr> <tr> <td align="right">优先级</td> <td align="left"><input data-rule="required; integer; range[1~100]; remote[get:${pageContext.request.contextPath}/withholdStrategy/checkPriority, priority]" type="text" name="priority" value="${withholdStrategyManagerForm.priority}"></td> </tr> <tr> <td align="right">生效时间</td> <td align="left"> <input type="text" data-rule="required; datetime;" name="startEffectDate" value="${withholdStrategyManagerForm.startEffectDate}" data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss"> <input type="text" data-rule="required; datetime; match[gte, startEffectDate];" name="endEffectDate" value="${withholdStrategyManagerForm.endEffectDate}" data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss"> </td> </tr>.
使用到了范围,比较,远端