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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? optionscollectiontag.java

?? struts的源代碼
?? JAVA
字號:
/*
 * $Id: OptionsCollectionTag.java 56513 2004-11-03 19:20:47Z niallp $ 
 *
 * Copyright 2002-2004 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.taglib.html;

import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.util.IteratorAdapter;
import org.apache.struts.taglib.TagUtils;
import org.apache.struts.util.MessageResources;

/**
 * Tag for creating multiple <select> options from a collection. The
 * collection may be part of the enclosing form, or may be independent of
 * the form. Each element of the collection must expose a 'label' and a
 * 'value', the property names of which are configurable by attributes of
 * this tag.
 * <p>
 * The collection may be an array of objects, a Collection, an Enumeration,
 * an Iterator, or a Map.
 * <p>
 * <b>NOTE</b> - This tag requires a Java2 (JDK 1.2 or later) platform.
 *
 * @version $Rev: 56513 $ $Date: 2004-11-03 19:20:47 +0000 (Wed, 03 Nov 2004) $
 * @since Struts 1.1
 */
public class OptionsCollectionTag extends TagSupport {

    // ----------------------------------------------------- Instance Variables

    /**
     * The message resources for this package.
     */
    protected static MessageResources messages =
        MessageResources.getMessageResources(Constants.Package + ".LocalStrings");

    // ------------------------------------------------------------- Properties

    /**
     * Should the label values be filtered for HTML sensitive characters?
     */
    protected boolean filter = true;

    public boolean getFilter() {
        return filter;
    }

    public void setFilter(boolean filter) {
        this.filter = filter;
    }

    /**
     * The name of the bean property containing the label.
     */
    protected String label = "label";

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * The name of the bean containing the values collection.
     */
    protected String name = Constants.BEAN_KEY;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * The name of the property to use to build the values collection.
     */
    protected String property = null;

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    /**
     * The style associated with this tag.
     */
    private String style = null;

    public String getStyle() {
        return style;
    }

    public void setStyle(String style) {
        this.style = style;
    }

    /**
     * The named style class associated with this tag.
     */
    private String styleClass = null;

    public String getStyleClass() {
        return styleClass;
    }

    public void setStyleClass(String styleClass) {
        this.styleClass = styleClass;
    }

    /**
     * The name of the bean property containing the value.
     */
    protected String value = "value";

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

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

    /**
     * Process the start of this tag.
     *
     * @exception JspException if a JSP exception has occurred
     */
    public int doStartTag() throws JspException {

        // Acquire the select tag we are associated with
        SelectTag selectTag = (SelectTag) pageContext.getAttribute(Constants.SELECT_KEY);

        if (selectTag == null) {
            JspException e = new JspException(messages.getMessage("optionsCollectionTag.select"));
            TagUtils.getInstance().saveException(pageContext, e);
            throw e;
        }

        // Acquire the collection containing our options
        Object collection = TagUtils.getInstance().lookup(pageContext, name, property, null);

        if (collection == null) {
            JspException e =
                new JspException(messages.getMessage("optionsCollectionTag.collection"));
            TagUtils.getInstance().saveException(pageContext, e);
            throw e;
        }

        // Acquire an iterator over the options collection
        Iterator iter = getIterator(collection);

        StringBuffer sb = new StringBuffer();

        // Render the options
        while (iter.hasNext()) {

            Object bean = iter.next();
            Object beanLabel = null;
            Object beanValue = null;

            // Get the label for this option
            try {
                beanLabel = PropertyUtils.getProperty(bean, label);
                if (beanLabel == null) {
                    beanLabel = "";
                }
            } catch (IllegalAccessException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.access", label, bean));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                JspException jspe =
                    new JspException(messages.getMessage("getter.result", label, t.toString()));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            } catch (NoSuchMethodException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.method", label, bean));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            }

            // Get the value for this option
            try {
                beanValue = PropertyUtils.getProperty(bean, value);
                if (beanValue == null) {
                    beanValue = "";
                }
            } catch (IllegalAccessException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.access", value, bean));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                JspException jspe =
                    new JspException(messages.getMessage("getter.result", value, t.toString()));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            } catch (NoSuchMethodException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.method", value, bean));
                TagUtils.getInstance().saveException(pageContext, jspe);
                throw jspe;
            }

            String stringLabel = beanLabel.toString();
            String stringValue = beanValue.toString();

            // Render this option
            addOption(sb, stringLabel, stringValue, selectTag.isMatched(stringValue));
        }

        TagUtils.getInstance().write(pageContext, sb.toString());

        return SKIP_BODY;
    }

    /**
     * Release any acquired resources.
     */
    public void release() {
        super.release();
        filter = true;
        label = "label";
        name = Constants.BEAN_KEY;
        property = null;
        style = null;
        styleClass = null;
        value = "value";
    }

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

    /**
     * Add an option element to the specified StringBuffer based on the
     * specified parameters.
     *<p>
     * Note that this tag specifically does not support the
     * <code>styleId</code> tag attribute, which causes the HTML
     * <code>id</code> attribute to be emitted.  This is because the HTML
     * specification states that all "id" attributes in a document have to be
     * unique.  This tag will likely generate more than one <code>option</code>
     * element element, but it cannot use the same <code>id</code> value.  It's
     * conceivable some sort of mechanism to supply an array of <code>id</code>
     * values could be devised, but that doesn't seem to be worth the trouble.
     *
     * @param sb StringBuffer accumulating our results
     * @param value Value to be returned to the server for this option
     * @param label Value to be shown to the user for this option
     * @param matched Should this value be marked as selected?
     */
    protected void addOption(StringBuffer sb, String label, String value, boolean matched) {

        sb.append("<option value=\"");
        if (filter) {
            sb.append(TagUtils.getInstance().filter(value));
        } else {
            sb.append(value);
        }
        sb.append("\"");
        if (matched) {
            sb.append(" selected=\"selected\"");
        }
        if (style != null) {
            sb.append(" style=\"");
            sb.append(style);
            sb.append("\"");
        }
        if (styleClass != null) {
            sb.append(" class=\"");
            sb.append(styleClass);
            sb.append("\"");
        }
        
        sb.append(">");
        
        if (filter) {
            sb.append(TagUtils.getInstance().filter(label));
        } else {
            sb.append(label);
        }
        
        sb.append("</option>\r\n");

    }

    /**
     * Return an iterator for the options collection.
     *
     * @param collection Collection to be iterated over
     *
     * @exception JspException if an error occurs
     */
    protected Iterator getIterator(Object collection) throws JspException {

        if (collection.getClass().isArray()) {
            collection = Arrays.asList((Object[]) collection);
        }

        if (collection instanceof Collection) {
            return (((Collection) collection).iterator());

        } else if (collection instanceof Iterator) {
            return ((Iterator) collection);

        } else if (collection instanceof Map) {
            return (((Map) collection).entrySet().iterator());

        } else if (collection instanceof Enumeration) {
            return new IteratorAdapter((Enumeration) collection);

        } else {
            throw new JspException(
                messages.getMessage("optionsCollectionTag.iterator", collection.toString()));
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品视频免费看| 欧美性大战久久| 国产精品一线二线三线精华| 国产精品1区2区3区| 国产精品99精品久久免费| 国产成人av电影在线播放| 欧美亚洲综合网| 91麻豆精品国产91久久久| 久久久久久日产精品| 中文字幕一区二区视频| 日韩综合小视频| 精品一区二区免费| 狠狠色丁香久久婷婷综| 97se亚洲国产综合自在线| 欧美唯美清纯偷拍| 久久久久久一级片| 一区二区三区**美女毛片| 久久99国产精品久久99果冻传媒| 国产传媒日韩欧美成人| 91久久精品一区二区| 精品国产91亚洲一区二区三区婷婷 | 91网站最新地址| 欧美在线观看视频一区二区| 久久久综合九色合综国产精品| 亚洲视频免费在线| 精品一区二区三区在线播放视频| 成人中文字幕电影| 91啦中文在线观看| 欧美不卡一二三| 亚洲丝袜美腿综合| 国产成人av一区| 欧美在线高清视频| 国产精品高清亚洲| 日韩成人精品视频| 日本韩国欧美一区| www亚洲一区| 亚洲一二三四区不卡| 国产乱码精品一区二区三区忘忧草 | 不卡一区二区中文字幕| 欧美猛男超大videosgay| 国产日韩在线不卡| 三级一区在线视频先锋| 国产一区二区三区四区五区美女 | 91小视频免费看| 国产午夜精品久久久久久久 | 国产69精品一区二区亚洲孕妇| 欧美日韩国产一级片| 国产精品国产三级国产| 国产成人免费av在线| 欧美精品在线一区二区三区| 亚洲综合在线观看视频| 国产酒店精品激情| 欧美一区二区三区四区在线观看| 国产精品福利影院| 久久99久久久欧美国产| 制服丝袜中文字幕亚洲| 一色桃子久久精品亚洲| 成人动漫视频在线| 欧美成va人片在线观看| 美女视频网站黄色亚洲| 欧美在线免费播放| 亚洲成在人线免费| 91麻豆高清视频| 亚洲欧洲制服丝袜| 成人免费av在线| 欧美精品黑人性xxxx| 国产精品女上位| 一区二区三区高清| 99久久免费视频.com| 欧美韩国日本综合| 国产成人高清在线| 久久嫩草精品久久久精品一| 久久99国产精品久久| 久久亚洲一区二区三区四区| 韩日欧美一区二区三区| 亚洲伊人色欲综合网| 日产国产高清一区二区三区| 色综合视频在线观看| 亚洲欧洲99久久| 99精品视频一区| 日韩精品在线网站| 国内一区二区在线| 精品久久一区二区| 国产成人av自拍| 舔着乳尖日韩一区| 日韩视频免费观看高清完整版在线观看| 亚洲男同1069视频| 欧美丰满少妇xxxxx高潮对白| 最近中文字幕一区二区三区| 91污片在线观看| 亚洲婷婷国产精品电影人久久| 91福利国产精品| 亚洲人成在线播放网站岛国| 欧美性猛交xxxx乱大交退制版 | 国产专区综合网| 国产午夜精品理论片a级大结局 | 91精品一区二区三区久久久久久| 男人的天堂亚洲一区| 日韩欧美一区二区免费| 国产成人高清在线| 国产精品无码永久免费888| 在线视频亚洲一区| 亚洲sss视频在线视频| ww亚洲ww在线观看国产| 国产成人在线视频免费播放| 亚洲三级小视频| 欧美日韩精品三区| 天堂一区二区在线| 久久九九全国免费| 91片在线免费观看| 美国十次了思思久久精品导航| 久久综合久久综合久久| 91丨porny丨国产入口| 亚洲在线免费播放| 国产亚洲成年网址在线观看| av中文一区二区三区| 午夜久久久久久| www国产精品av| 欧美在线观看禁18| 久久精品国产一区二区三区免费看| 国产精品久久久久一区| 欧美午夜精品一区二区蜜桃| 中文字幕欧美激情一区| 欧美精品 日韩| 国产成人一级电影| 日韩一区精品视频| 久久精品一级爱片| 欧美剧情片在线观看| 国产成人一区在线| 日本成人中文字幕在线视频| 国产日韩三级在线| 日韩视频一区二区三区在线播放| 国产91高潮流白浆在线麻豆| 秋霞午夜鲁丝一区二区老狼| 国产人伦精品一区二区| 91精品欧美福利在线观看| 国产不卡视频一区| 免费成人在线视频观看| 国产丝袜在线精品| 欧美一区二区三区成人| 成人91在线观看| 亚洲国产一区二区视频| 久久综合99re88久久爱| 91在线观看下载| 国产乱对白刺激视频不卡| 一区二区激情视频| 亚洲欧洲在线观看av| 欧美一区二区三区精品| 欧美中文字幕一区二区三区亚洲| 国产在线视频精品一区| 日韩电影在线看| 亚洲视频一二三| 日本一区二区高清| 欧美一区二区福利视频| 欧美性猛交一区二区三区精品| 国产成人精品亚洲午夜麻豆| 欧美96一区二区免费视频| 亚洲麻豆国产自偷在线| 国产精品夫妻自拍| 欧美xxxxx牲另类人与| 欧美巨大另类极品videosbest| 欧美美女网站色| 欧美日韩精品高清| 99r国产精品| 99re这里只有精品视频首页| 久久99精品国产.久久久久久 | 成人自拍视频在线观看| 国内精品免费在线观看| 天天色天天爱天天射综合| 亚洲午夜电影在线观看| 国产精品素人一区二区| 国产精品视频一二三区| 久久久青草青青国产亚洲免观| 日韩欧美在线网站| 欧美日本精品一区二区三区| 欧美影院一区二区三区| 99国产一区二区三精品乱码| 成人黄色777网| 国产成人综合亚洲网站| 国产激情视频一区二区在线观看| 日韩 欧美一区二区三区| 亚洲国产婷婷综合在线精品| 亚洲免费在线观看| 亚洲欧洲色图综合| 精品国产一区二区三区久久影院| 欧美系列在线观看| 色欧美88888久久久久久影院| 97se亚洲国产综合在线| 91久久人澡人人添人人爽欧美| 91性感美女视频| 欧美午夜免费电影| 色婷婷亚洲综合| 欧美视频一二三区| 日本黄色一区二区| 欧美日韩情趣电影| 7777女厕盗摄久久久| 777a∨成人精品桃花网| 欧美mv日韩mv| 久久一区二区视频| 国产精品第13页|