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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? beanvalidatorform.java

?? struts的源代碼
?? JAVA
字號(hào):
/*
 * Copyright 2004-2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.struts.validator;

import java.util.List;
import java.util.Map;
import java.lang.reflect.Array;
import java.io.Serializable;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;
import org.apache.commons.beanutils.DynaClass;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.WrapDynaBean;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * <p>Struts <i>validator</i> <code>ActionForm</code> backed by either a <code>DynaBean</code> or POJO JavaBean.</p>
 *
 * <p>Passing a POJO JavaBean to the constructor will automatically create an associated
 *    <code>WrapDynaBean</code>. One use for this would be to migrate <i>view</i>
 *    objects from an existing system which, for the usual reasons, can't be changed to extend
 *    <ActionForm</code>.</p>
 *
 * <p>This form is based on the standard struts <code>ValidatorForm</code> for use with the
 *    <i>Validator</i> framework and validates either using the <i>name</i> from the Struts
 *    <code>ActionMapping</code> or the  <code>ActionMapping</code>'s path depending on
 *    whether <code>pathValidation</code> is <code>true</code> or <code>false</code>.</p>
 */
public class BeanValidatorForm extends ValidatorForm implements DynaBean, Serializable {

   /**
    * Commons Logging
    */
    protected static Log logger = LogFactory.getLog(BeanValidatorForm.class);

    /**
     * The <code>DynaBean</code> that this ActionForm is backed by.
     */
    protected DynaBean dynaBean;

    /**
     * Indicates whether the ActionMapping's path should be used for the
     * validation key.
     */
    protected boolean pathValidation = false;

    // ------------------- Constructor ----------------------------------

    /**
     * Construct a new <code>BeanValidatorForm</code> with the specified bean.
     */
    public BeanValidatorForm(Object bean) {

        if (bean instanceof DynaBean) {

            dynaBean = (DynaBean)bean;

        } else {

            dynaBean = new WrapDynaBean(bean);

        }
    }

    // ------------------- Protected Methods ----------------------------------

   /**
    * <p>Set whether this form should validate based on the <code>ActionMapping</code>'s path.</p>
    */
    protected void setPathValidation(boolean pathValidation) {
        this.pathValidation = pathValidation;
    }

   /**
    * <p>Indicates whether this form should validate based on the <code>ActionMapping</code>'s path.</p>
    */
    protected boolean isPathValidation() {
        return pathValidation;
    }


    // ------------------- Public Methods ----------------------------------

   /**
    * <p>Return the <code>DynaBean</code> that this <code>ActionForm</code> is backed by.</p>
    */
    public DynaBean getDynaBean() {
        return dynaBean;
    }

   /**
    * <p>Return the <code>Bean</code> that this <code>ActionForm</code> is backed by.</p>
    *
    * <p>If the <code>DynaBean</code> is a <code>WrapDynaBean</code> type then this method
    * returns the 'Wrapped' POJO bean associated with it. If you require the actual <code>WrapDynaBean</code>
    * then use the <code>getDynaBean()</code> method.</p>
    */
    public Object getInstance() {

        if (dynaBean instanceof WrapDynaBean) {
            return ((WrapDynaBean)dynaBean).getInstance();
        }

        return dynaBean;

    }

   /**
    * <p>Return the size of an indexed or mapped property.</p>
    */
    public int size(String name) {

        Object value = dynaBean.get(name);
        if (value == null) {
            return 0;
        }

        if (value instanceof Map) {
            return ((Map)value).size();
        }

        if (value instanceof List) {
            return ((List)value).size();
        }

        if ((value.getClass().isArray())) {
            return Array.getLength(value);
        }

        return 0;

    }

    // ------------------- ValidatorForm Methods ----------------------------------

    /**
     * Returns the Validation key
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     * @return validation key to use
     */
    public String getValidationKey(ActionMapping mapping,
                                   HttpServletRequest request) {

        String validationKey = null;

        if (isPathValidation()) {

            // Get the path replacing any slashes by underscore
            validationKey = mapping.getPath();

            // Remove any leading slash
            if (validationKey.charAt(0) == '/') {
                validationKey = validationKey.substring(1);
            }

            // Replace any slashes by underscore
            if (validationKey.indexOf("/") > 0) {
                validationKey = validationKey.replace('/', '_');
            }

        } else {

            validationKey = mapping.getAttribute();

        }

        if (logger.isDebugEnabled()) {
            logger.debug("Validating ActionForm '" + mapping.getName() +
                         "' using key '" + validationKey + 
                         "' for mapping '" + mapping.getPath() + "'");
        }


        return validationKey;

    }

    // ------------------- DynaBean Methods ----------------------------------

   /**
    * Return the <code>DynaClass</code> instance that describes the set of
    * properties available for this DynaBean. 
    */
    public DynaClass getDynaClass() {
        return dynaBean.getDynaClass();
    }

   /**
     * Return the value of a simple property with the specified name.
     *
     * @param name Name of the property whose value is to be retrieved
    */
    public Object get(String name) {
        return dynaBean.get(name);
    }

   /**
     * Return the value of an indexed property with the specified name.
     *
     * @param name Name of the property whose value is to be retrieved
     * @param index Index of the value to be retrieved
    */
    public Object get(String name, int index) {
        return dynaBean.get(name, index);
    }

   /**
     * Return the value of a mapped property with the specified name,
     * or <code>null</code> if there is no value for the specified key.
     *
     * @param name Name of the property whose value is to be retrieved
     * @param key Key of the value to be retrieved
    */
    public Object get(String name, String key) {
        return dynaBean.get(name, key);
    }

   /**
     * Set the value of a simple property with the specified name.
     *
     * @param name Name of the property whose value is to be set
     * @param value Value to which this property is to be set
    */
    public void set(String name, Object value) {

        // Set the page number (for validator)
        if ("page".equals(name)) {

            if (value == null) {
                page = 0;
            } else  if (value instanceof Integer) {
                page = ((Integer)value).intValue();
            } else {
                try {
                    page = ((Integer)ConvertUtils.convert(value.toString(), Integer.class)).intValue();
                }
                catch (Exception ignore) {
                    page = 0;
                }
            }
        }

        dynaBean.set(name, value);

    }

   /**
     * Set the value of an indexed property with the specified name.
     *
     * @param name Name of the property whose value is to be set
     * @param index Index of the property to be set
     * @param value Value to which this property is to be set
    */
    public void set(String name, int index, Object value) {
        dynaBean.set(name, index, value);
    }

   /**
     * Set the value of a mapped property with the specified name.
     *
     * @param name Name of the property whose value is to be set
     * @param key Key of the property to be set
     * @param value Value to which this property is to be set
    */
    public void set(String name, String key, Object value) {
        dynaBean.set(name, key, value);
    }

   /**
     * Does the specified mapped property contain a value for the specified
     * key value?
     *
     * @param name Name of the property to check
     * @param key Name of the key to check
    */
    public boolean contains(String name, String key) {
        return dynaBean.contains(name, key);
    }

   /**
     * Remove any existing value for the specified key on the
     * specified mapped property.
     *
     * @param name Name of the property for which a value is to
     *  be removed
     * @param key Key of the value to be removed
    */
    public void remove(String name, String key) {
        dynaBean.remove(name, key);
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久福利网站| 51精品国自产在线| 欧美日韩在线播| 国产欧美日韩视频在线观看| 亚洲成人一二三| 成人精品国产免费网站| 91精品在线观看入口| 亚洲女与黑人做爰| 国产电影精品久久禁18| 欧美疯狂做受xxxx富婆| 91原创在线视频| 精品一区二区三区欧美| 91香蕉视频黄| 欧美亚洲国产一区二区三区va | 91在线视频播放| 欧美一区二区二区| 亚洲一卡二卡三卡四卡| 成人午夜视频在线观看| 欧美精品一区二区在线播放 | 欧美日韩五月天| 亚洲人成精品久久久久久| 国产美女精品一区二区三区| 欧美一区二区三区爱爱| 日日噜噜夜夜狠狠视频欧美人| 99re免费视频精品全部| 国产精品区一区二区三| 成人国产精品免费观看动漫| 91美女片黄在线| 欧美理论片在线| 91丨九色丨蝌蚪富婆spa| 精品动漫一区二区三区在线观看| 日精品一区二区| 538在线一区二区精品国产| 亚洲成人先锋电影| 91精品啪在线观看国产60岁| 亚洲成人tv网| 欧美福利视频导航| 久久精品72免费观看| 久久综合成人精品亚洲另类欧美| 极品销魂美女一区二区三区| 精品毛片乱码1区2区3区| 韩国一区二区视频| 国产精品色哟哟| 日本精品免费观看高清观看| 亚洲图片自拍偷拍| 日韩欧美一级精品久久| 国产精品一区二区久久精品爱涩| 欧美精品一区二区高清在线观看 | 欧美性三三影院| 亚洲精选视频免费看| 91麻豆swag| 五月天中文字幕一区二区| 欧美一级艳片视频免费观看| 久久精品免费看| 欧美国产精品专区| 91久久一区二区| 青青青爽久久午夜综合久久午夜| 精品久久国产97色综合| 不卡大黄网站免费看| 亚洲午夜一区二区| 精品国产污网站| 成人免费视频视频在线观看免费| 亚洲一区二区三区爽爽爽爽爽| 欧美一区永久视频免费观看| 国产91精品一区二区| 亚洲二区在线视频| 久久伊99综合婷婷久久伊| 亚洲精品视频一区| 欧美一区二区三区四区久久| 亚洲精选视频免费看| 日韩一区二区三区免费看 | 亚洲福利一区二区三区| 精品欧美一区二区三区精品久久| 成人不卡免费av| 日本vs亚洲vs韩国一区三区| 久久天堂av综合合色蜜桃网| 色哟哟精品一区| 久久99精品国产.久久久久 | 欧美一区二区三区小说| 99在线视频精品| 美国十次了思思久久精品导航| 亚洲欧美偷拍卡通变态| 久久久久久久久久看片| 欧美人伦禁忌dvd放荡欲情| 国产成人免费高清| 视频一区视频二区中文| 最新不卡av在线| 精品福利一区二区三区免费视频| 欧美性色欧美a在线播放| 韩国成人在线视频| 精品成人一区二区| 欧美日韩一区二区三区四区五区| 亚洲国产精品久久久久秋霞影院 | 日韩三级中文字幕| 国产麻豆成人传媒免费观看| 天天色 色综合| 亚洲视频在线一区二区| 久久精品亚洲精品国产欧美 | 精品亚洲欧美一区| 日韩一区精品视频| 亚洲啪啪综合av一区二区三区| 久久久久久久久蜜桃| 精品国精品国产| 日韩天堂在线观看| 欧美日韩国产影片| 欧美亚洲禁片免费| 欧亚洲嫩模精品一区三区| 欧美美女网站色| 日韩一区二区电影在线| 人人爽香蕉精品| 色狠狠av一区二区三区| 国产综合久久久久久鬼色| 亚洲一区二区在线免费看| 亚洲欧美电影一区二区| 亚洲图片另类小说| 国产精品美女久久久久久久久久久 | 欧美日精品一区视频| 91美女视频网站| 一本久久综合亚洲鲁鲁五月天| 99视频热这里只有精品免费| 福利电影一区二区三区| eeuss鲁一区二区三区| av一区二区三区四区| 一本一道波多野结衣一区二区| 99精品视频在线观看免费| 99国产精品国产精品久久| 91女厕偷拍女厕偷拍高清| 一本一道综合狠狠老| 欧美日韩一区国产| 9191久久久久久久久久久| 91精品国产91热久久久做人人| 日韩一区二区免费在线观看| 精品免费国产一区二区三区四区| 精品国产一区二区三区久久影院| 国产欧美日韩另类一区| 亚洲男女毛片无遮挡| 亚洲aaa精品| 国产尤物一区二区在线| 成人av资源在线| 欧美色电影在线| 久久天堂av综合合色蜜桃网| 亚洲欧洲一区二区三区| 首页国产欧美久久| 国产一区二区按摩在线观看| 一本大道av一区二区在线播放| 欧美日韩精品久久久| 久久久综合激的五月天| 亚洲另类春色国产| 精品亚洲成a人| 91免费视频网| 欧美大白屁股肥臀xxxxxx| 国产精品免费aⅴ片在线观看| 亚洲综合图片区| 韩日精品视频一区| 欧美亚洲日本国产| 精品第一国产综合精品aⅴ| 亚洲女人的天堂| 国产综合久久久久久久久久久久 | 丁香婷婷深情五月亚洲| 91麻豆6部合集magnet| 日韩精品一区二区三区在线| 国产精品伦一区| 奇米一区二区三区| 99国产精品久久久久久久久久| 91麻豆精品国产91久久久久| 国产精品乱人伦| 久久99国产精品久久99果冻传媒| 91免费视频观看| 久久久青草青青国产亚洲免观| 亚洲午夜视频在线观看| 成人动漫一区二区三区| 久久综合中文字幕| 亚洲二区在线观看| 99精品久久免费看蜜臀剧情介绍| 日韩午夜中文字幕| 亚洲国产综合在线| 成人黄色在线看| 欧美精品一区视频| 蜜臀av在线播放一区二区三区| 91免费观看国产| 日本一区二区三区在线观看| 久久精品国产一区二区| 欧美在线观看18| 亚洲欧美激情一区二区| 风间由美中文字幕在线看视频国产欧美| 国产欧美中文在线| 亚洲一区在线看| 成人黄色在线看| 国产精品毛片a∨一区二区三区| 麻豆视频观看网址久久| 51精品国自产在线| 丝袜美腿一区二区三区| 欧美在线观看视频一区二区| 中文字幕一区av| hitomi一区二区三区精品| 国产欧美精品区一区二区三区| 国产在线精品一区二区不卡了 | 中文字幕第一区二区| 成人中文字幕合集| 国产精品三级久久久久三级|