这是我日期类型的验证字段,而current
是一个隐藏变量,其中包含get&动作类中的setter:
<param name="min">01/01/1920</param>
<param name="max">${new java.util.Date(current}</param>
<message>Your Birth date must be less than ${min} and ${max} date!</message>
请帮助上面的代码工作为min,但最大值为空白..
答案 0 :(得分:0)
动作:
private Date current;
public Date getCurrent(){
return current;
}
验证
<field name="birthday">
<field-validator type="date">
<param name="minExpression">01/01/1920</param>
<param name="maxExpression">${current}</param> <!--calls getCurrent();-->
<message>
<![CDATA[ Your Birth date must be between ${min} and ${max}! ]]>
</message>
</field-validator>
</field>
另外看看at the documentation,这一切都在那里解释。