0

这是我的日期类型验证字段,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>

请帮助上面的代码为最小值工作,但最大值为空白..

4

1 回答 1

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>

还要看看文档,那里都有解释。

于 2014-11-28T09:41:58.600 回答