1. 这两个都是用于日期校验的, 区别是Strict更严格, 它会同时校验输入日期的长度是否合法.
比如: 1/1/2004 对于 MM/dd/yyyy这样一Pattern来说是非法的.2. 这个参数和上面是一样的, 是否校验长度

解决方案 »

  1.   

    但是生成的javascript脚本还是无法校验 1/1/2004这种长度, 必须 01/01/2004
    有没有什么办法解决
      

  2.   

    最后一参是指:是否检查输入的日期位数与patten一致。
    参考:
    public static java.util.Date formatDate(java.lang.String value,
                                            java.lang.String datePattern,
                                            boolean strict)Checks if the field is a valid date. The pattern is used with java.text.SimpleDateFormat . If strict is true, then the length will be checked so '2/12/1999' will not pass validation with the format 'MM/dd/yyyy' because the month isn't two digits. The setLenient method is set to false for all. 
    Parameters:
    value - The value validation is being performed on.
    datePattern - The pattern passed to SimpleDateFormat.
    strict - Whether or not to have an exact match of the datePattern.