亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fieldchecks.java

?? struts的源代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
     *  vars attribute).
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return True if in range, false otherwise.
     */
    public static boolean validateFloatRange(Object bean,
                                             ValidatorAction va, Field field,
                                             ActionMessages errors,
                                             Validator validator,
                                             HttpServletRequest request) {

        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (!GenericValidator.isBlankOrNull(value)) {
            try {
                float floatValue = Float.parseFloat(value);
                float min = Float.parseFloat(field.getVarValue("min"));
                float max = Float.parseFloat(field.getVarValue("max"));

                if (!GenericValidator.isInRange(floatValue, min, max)) {
                    errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));

                    return false;
                }
            } catch (Exception e) {
                errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
                return false;
            }
        }

        return true;
    }


    /**
     *  Checks if the field is a valid credit card number.
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return true if valid, false otherwise.
     */
    public static Object validateCreditCard(Object bean,
                                          ValidatorAction va, Field field,
                                          ActionMessages errors,
                                          Validator validator,
                                          HttpServletRequest request) {

        Object result = null;
        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (GenericValidator.isBlankOrNull(value)) {
            return Boolean.TRUE;
        }

        result = GenericTypeValidator.formatCreditCard(value);

        if (result == null) {
            errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
        }

        return result == null ? Boolean.FALSE : result;

    }


    /**
     *  Checks if a field has a valid e-mail address.
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return True if valid, false otherwise.
     */
    public static boolean validateEmail(Object bean,
                                        ValidatorAction va, Field field,
                                        ActionMessages errors,
                                        Validator validator,
                                        HttpServletRequest request) {

        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isEmail(value)) {
            errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
            return false;
        } else {
            return true;
        }
    }


    /**
     *  Checks if the field's length is less than or equal to the maximum value.
     *  A <code>Null</code> will be considered an error.
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return True if stated conditions met.
     */
    public static boolean validateMaxLength(Object bean,
                                            ValidatorAction va, Field field,
                                            ActionMessages errors,
                                            Validator validator,
                                            HttpServletRequest request) {

        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (value != null) {
            try {
                int max = Integer.parseInt(field.getVarValue("maxlength"));

                if (!GenericValidator.maxLength(value, max)) {
                    errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));

                    return false;
                }
            } catch (Exception e) {
                errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
                return false;
            }
        }

        return true;
    }


    /**
     * Checks if the field's length is greater than or equal to the minimum value.
     * A <code>Null</code> will be considered an error.
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return True if stated conditions met.
     */
    public static boolean validateMinLength(Object bean,
                                            ValidatorAction va, Field field,
                                            ActionMessages errors,
                                            Validator validator,
                                            HttpServletRequest request) {

        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (!GenericValidator.isBlankOrNull(value)) {
            try {
                int min = Integer.parseInt(field.getVarValue("minlength"));

                if (!GenericValidator.minLength(value, min)) {
                    errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));

                    return false;
                }
            } catch (Exception e) {
                errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
                return false;
            }
        }

        return true;
    }

    /**
     * Checks if a field has a valid url. Four optional variables can be
     * specified to configure url validation.
     * <ul>
     *    <li>Variable <code>allow2slashes</code> can be set to <code>true</code> or
     *        <code>false</code> to control whether two slashes are allowed -
     *        default is <code>false</code> (i.e. two slashes are NOT allowed).</li>
     *    <li>Variable <code>nofragments</code> can be set to <code>true</code> or
     *        <code>false</code> to control whether fragments are allowed -
     *        default is <code>false</code> (i.e. fragments ARE allowed).</li>
     *    <li>Variable <code>allowallschemes</code> can be set to <code>true</code> or
     *        <code>false</code> to control if all schemes are allowed - default
     *        is <code>false</code> (i.e. all schemes are NOT allowed).</li>
     *    <li>Variable <code>schemes</code> can be set to a comma delimited list of
     *        valid schemes. This value is ignored if <code>allowallschemes</code>
     *        is set to <code>true</code>. Default schemes allowed are "http",
     *        "https" and "ftp" if this variable is not specified.</li>
     * </ul>
     *
     * @param  bean     The bean validation is being performed on.
     * @param  va       The <code>ValidatorAction</code> that is currently being performed.
     * @param  field    The <code>Field</code> object associated with the current
     *      field being validated.
     * @param  errors   The <code>ActionMessages</code> object to add errors to if any
     *      validation errors occur.
     * @param validator The <code>Validator</code> instance, used to access
     *      other field values.
     * @param  request  Current request object.
     * @return True if valid, false otherwise.
     */
    public static boolean validateUrl(Object bean,
                                        ValidatorAction va, Field field,
                                        ActionMessages errors,
                                        Validator validator,
                                        HttpServletRequest request) {

        String value = null;
        if (isString(bean)) {
            value = (String) bean;
        } else {
            value = ValidatorUtils.getValueAsString(bean, field.getProperty());
        }

        if (GenericValidator.isBlankOrNull(value)) {
            return true;
        }

        // Get the options and schemes Vars
        boolean allowallschemes = "true".equalsIgnoreCase(field.getVarValue("allowallschemes"));
        int options = allowallschemes ? UrlValidator.ALLOW_ALL_SCHEMES : 0;

        if ("true".equalsIgnoreCase(field.getVarValue("allow2slashes"))) {
          options += UrlValidator.ALLOW_2_SLASHES;
        }

        if ("true".equalsIgnoreCase(field.getVarValue("nofragments"))) {
          options += UrlValidator.NO_FRAGMENTS;
        }

        String schemesVar = allowallschemes ? null : field.getVarValue("schemes");

        // No options or schemes - use GenericValidator as default
        if (options == 0 && schemesVar == null) {
            if (GenericValidator.isUrl(value)) {
                return true;
            } else {
                errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
                return false;
            }
        }

        // Parse comma delimited list of schemes into a String[]
        String[] schemes = null;
        if (schemesVar != null) {

          StringTokenizer st = new StringTokenizer(schemesVar, ",");
          schemes = new String[st.countTokens()];

          int i = 0;
          while (st.hasMoreTokens()) {
              schemes[i++] = st.nextToken().trim();
          }

        }

        // Create UrlValidator and validate with options/schemes
        UrlValidator urlValidator = new UrlValidator(schemes, options);
        if (urlValidator.isValid(value)) {
            return true;
        } else {
            errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field));
            return false;
        }
    }

    /**
     *  Return <code>true</code> if the specified object is a String or a <code>null</code>
     *  value.
     *
     * @param o Object to be tested
     * @return The string value
     */
    protected static boolean isString(Object o) {
        return (o == null) ? true : String.class.isInstance(o);
    }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区视频在线观看| 国产欧美日韩精品在线| 色婷婷综合激情| 成人免费观看视频| 国产精品12区| 国模无码大尺度一区二区三区| 蜜臀久久99精品久久久久宅男 | 亚洲一区精品在线| 亚洲欧美精品午睡沙发| 亚洲超碰97人人做人人爱| 精品久久国产字幕高潮| 久久精品日韩一区二区三区| 欧美专区日韩专区| 国产精一区二区三区| 香蕉久久一区二区不卡无毒影院| 欧美在线观看视频在线| 成人av影视在线观看| 九九久久精品视频| 日韩影院在线观看| 亚洲成人动漫在线观看| 亚洲一区欧美一区| 久久综合久久鬼色中文字| 韩国成人在线视频| 五月婷婷久久综合| 三级一区在线视频先锋| 午夜婷婷国产麻豆精品| 久久综合一区二区| 国产成人夜色高潮福利影视| 欧美激情综合五月色丁香| 成人一级黄色片| 综合久久综合久久| www国产精品av| 91精品欧美一区二区三区综合在| 欧美性一级生活| 欧美精品一卡两卡| 欧美男同性恋视频网站| 在线成人午夜影院| 5566中文字幕一区二区电影| 成人激情小说乱人伦| 欧美激情艳妇裸体舞| 国产不卡视频在线播放| 色综合色综合色综合| 91丝袜美女网| 综合欧美亚洲日本| 日本不卡的三区四区五区| 亚洲高清中文字幕| 天涯成人国产亚洲精品一区av| 中文字幕第一页久久| 欧美国产精品一区| 亚洲欧美另类小说| 亚洲成人av中文| 图片区小说区区亚洲影院| 奇米色777欧美一区二区| 国产一区二区三区| 欧美在线影院一区二区| 精品精品国产高清一毛片一天堂| 日韩一区欧美一区| 蜜桃视频一区二区三区| 99在线精品免费| 日韩精品一区二区三区老鸭窝| 日韩一区在线播放| 韩国欧美国产一区| 欧美熟乱第一页| 国产精品久久一级| 精品一区二区免费| 欧美日韩中文一区| 国产精品成人免费在线| 成人美女视频在线观看| 日韩欧美中文字幕精品| 国产精品夫妻自拍| 日韩欧美一级二级三级久久久 | 一本色道久久综合精品竹菊| 91精品国产免费久久综合| 亚洲色图视频网| 国产麻豆一精品一av一免费| 欧美日韩亚洲另类| 国产精品私人影院| 久久爱另类一区二区小说| 91久久奴性调教| 国产欧美精品日韩区二区麻豆天美| 日韩中文字幕亚洲一区二区va在线 | 国产性色一区二区| 美洲天堂一区二卡三卡四卡视频 | 欧美日韩精品系列| 国产精品久久久久影院老司| 精品写真视频在线观看| 欧美猛男gaygay网站| 亚洲视频免费看| 波多野结衣在线一区| 久久久亚洲精品一区二区三区| 欧美aaaaa成人免费观看视频| 欧美性色综合网| 亚洲一区成人在线| 在线观看91视频| 亚洲精品中文在线影院| 99re亚洲国产精品| 国产精品视频yy9299一区| 国产成人综合在线| 欧美激情一区二区三区全黄| 国产麻豆精品久久一二三| 欧美变态凌虐bdsm| 精品一区二区成人精品| 日韩女优视频免费观看| 久久99久久久久| 精品久久久久一区二区国产| 老司机午夜精品| 精品精品国产高清a毛片牛牛| 久久av资源网| 日韩欧美123| 九九热在线视频观看这里只有精品| 日韩欧美在线综合网| 国产一区中文字幕| 欧美国产在线观看| 99视频精品在线| 亚洲美女淫视频| 欧美精品成人一区二区三区四区| 午夜精品久久一牛影视| 欧美一区在线视频| 激情综合色综合久久| 久久精品免视看| 99国产精品久| 夜夜亚洲天天久久| 91精品国产乱| 国产一区二区三区国产| 中文字幕成人在线观看| 91一区二区在线| 午夜精品久久一牛影视| 精品国产不卡一区二区三区| 国产成人精品影视| 亚洲黄色在线视频| 欧美人与z0zoxxxx视频| 久久国产福利国产秒拍| 国产精品久久久一本精品| 在线国产电影不卡| 欧美日韩高清一区| 色香色香欲天天天影视综合网| 国产成人免费视频网站| 精品影院一区二区久久久| 日韩不卡免费视频| 日韩黄色小视频| 日本午夜精品视频在线观看| 国产一区二区视频在线| 蜜桃视频第一区免费观看| 午夜影院久久久| 捆绑调教一区二区三区| 亚洲国产成人在线| 成人黄色a**站在线观看| 一区二区三区精品久久久| 欧美一级片在线| 国产成人在线看| 亚洲成a人v欧美综合天堂| 久久久久久免费| 在线观看免费视频综合| 国内精品视频666| 亚洲精品美国一| 精品第一国产综合精品aⅴ| 色94色欧美sute亚洲13| 国内精品久久久久影院色| 洋洋av久久久久久久一区| 久久先锋影音av| 欧美日韩国产高清一区| 国产成人免费视频精品含羞草妖精 | 在线一区二区三区四区| 久久99蜜桃精品| 亚洲一区二区视频在线观看| 久久综合色鬼综合色| 欧美性高清videossexo| 成人一区二区在线观看| 日韩不卡在线观看日韩不卡视频| 国产精品九色蝌蚪自拍| 久久亚洲综合色| 91精品婷婷国产综合久久| 99精品视频一区二区三区| 国内精品视频666| 日本欧美一区二区| 亚洲综合在线视频| 国产精品久久久久永久免费观看| 日韩一区二区三区高清免费看看 | 亚洲欧美一区二区三区久本道91| 26uuu国产电影一区二区| 欧美高清视频www夜色资源网| 99视频一区二区| 大尺度一区二区| 国产露脸91国语对白| 在线观看日韩毛片| 久久久91精品国产一区二区精品| 亚洲福中文字幕伊人影院| 成人午夜视频免费看| 久久精品网站免费观看| 免费在线看成人av| 久久久www免费人成精品| 精品国产sm最大网站| 精品久久久久av影院| 久久久精品黄色| 日韩视频国产视频| 加勒比av一区二区| 国产亚洲1区2区3区| 99久久婷婷国产综合精品电影| 日韩美女视频一区二区| 91麻豆国产福利在线观看|