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

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

?? optionstag.java

?? 這是STRUTS1.2。6的開發包。。這是我從芝APACHE網站下下來
?? JAVA
字號:
/*
 * $Id: OptionsTag.java 56513 2004-11-03 19:20:47Z niallp $ 
 *
 * Copyright 1999-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
 * associated values displayed to the user may optionally be specified by a
 * second collection, or will be the same as the values themselves.  Each
 * collection may be an array of objects, a Collection, an Enumeration,
 * an Iterator, or a Map.
 * <b>NOTE</b> - This tag requires a Java2 (JDK 1.2 or later) platform.
 *
 */

public class OptionsTag extends TagSupport {

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

    /**
     * The name of the collection containing beans that have properties to
     * provide both the values and the labels (identified by the
     * <code>property</code> and <code>labelProperty</code> attributes).
     */
    protected String collection = null;

    public String getCollection() {
        return (this.collection);
    }

    public void setCollection(String collection) {
        this.collection = collection;
    }

    /**
     * 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 containing the labels collection.
     */
    protected String labelName = null;

    public String getLabelName() {
        return labelName;
    }

    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }

    /**
     * The bean property containing the labels collection.
     */
    protected String labelProperty = null;

    public String getLabelProperty() {
        return labelProperty;
    }

    public void setLabelProperty(String labelProperty) {
        this.labelProperty = labelProperty;
    }

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

    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;
    }

    /**
     * Process the start of this tag.
     *
     * @exception JspException if a JSP exception has occurred
     */

    public int doStartTag() throws JspException {
        return SKIP_BODY;
    }

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

        // Acquire the select tag we are associated with
        SelectTag selectTag = (SelectTag) pageContext.getAttribute(Constants.SELECT_KEY);
        if (selectTag == null) {
            throw new JspException(messages.getMessage("optionsTag.select"));
        }
        StringBuffer sb = new StringBuffer();

        // If a collection was specified, use that mode to render options
        if (collection != null) {
            Iterator collIterator = getIterator(collection, null);
            while (collIterator.hasNext()) {

                Object bean = collIterator.next();
                Object value = null;
                Object label = null;

                try {
                    value = PropertyUtils.getProperty(bean, property);
                    if (value == null) {
                        value = "";
                    }
                } catch (IllegalAccessException e) {
                    throw new JspException(
                        messages.getMessage("getter.access", property, collection));
                } catch (InvocationTargetException e) {
                    Throwable t = e.getTargetException();
                    throw new JspException(
                        messages.getMessage("getter.result", property, t.toString()));
                } catch (NoSuchMethodException e) {
                    throw new JspException(
                        messages.getMessage("getter.method", property, collection));
                }

                try {
                    if (labelProperty != null) {
                        label = PropertyUtils.getProperty(bean, labelProperty);
                    } else {
                        label = value;
                    }

                    if (label == null) {
                        label = "";
                    }
                } catch (IllegalAccessException e) {
                    throw new JspException(
                        messages.getMessage("getter.access", labelProperty, collection));
                } catch (InvocationTargetException e) {
                    Throwable t = e.getTargetException();
                    throw new JspException(
                        messages.getMessage("getter.result", labelProperty, t.toString()));
                } catch (NoSuchMethodException e) {
                    throw new JspException(
                        messages.getMessage("getter.method", labelProperty, collection));
                }

                String stringValue = value.toString();
                addOption(sb, stringValue, label.toString(), selectTag.isMatched(stringValue));

            }

        }

        // Otherwise, use the separate iterators mode to render options
        else {

            // Construct iterators for the values and labels collections
            Iterator valuesIterator = getIterator(name, property);
            Iterator labelsIterator = null;
            if ((labelName == null) && (labelProperty == null)) {
                labelsIterator = getIterator(name, property); // Same coll.
            } else {
                labelsIterator = getIterator(labelName, labelProperty);
            }

            // Render the options tags for each element of the values coll.
            while (valuesIterator.hasNext()) {
                Object valueObject = valuesIterator.next();
                if (valueObject == null) {
                    valueObject = "";
                }
                String value = valueObject.toString();
                String label = value;
                if (labelsIterator.hasNext()) {
                    Object labelObject = labelsIterator.next();
                    if (labelObject == null) {
                        labelObject = "";
                    }
                    label = labelObject.toString();
                }
                addOption(sb, value, label, selectTag.isMatched(value));
            }
        }

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

        return EVAL_PAGE;

    }

    /**
     * Release any acquired resources.
     */
    public void release() {

        super.release();
        collection = null;
        filter = true;
        labelName = null;
        labelProperty = null;
        name = null;
        property = null;
        style = null;
        styleClass = null;
    }

    // ------------------------------------------------------ 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 value, String label, 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 option labels or values, based on our
     * configured properties.
     *
     * @param name Name of the bean attribute (if any)
     * @param property Name of the bean property (if any)
     *
     * @exception JspException if an error occurs
     */
    protected Iterator getIterator(String name, String property) throws JspException {

        // Identify the bean containing our collection
        String beanName = name;
        if (beanName == null) {
            beanName = Constants.BEAN_KEY;
        }

        Object bean = TagUtils.getInstance().lookup(pageContext, beanName, null);
        if (bean == null) {
            throw new JspException(messages.getMessage("getter.bean", beanName));
        }

        // Identify the collection itself
        Object collection = bean;
        if (property != null) {
            try {
                collection = PropertyUtils.getProperty(bean, property);
                if (collection == null) {
                    throw new JspException(messages.getMessage("getter.property", property));
                }
            } catch (IllegalAccessException e) {
                throw new JspException(messages.getMessage("getter.access", property, name));
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                throw new JspException(
                    messages.getMessage("getter.result", property, t.toString()));
            } catch (NoSuchMethodException e) {
                throw new JspException(messages.getMessage("getter.method", property, name));
            }
        }

        // Construct and return an appropriate iterator
        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("optionsTag.iterator", collection.toString()));
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合男人的天堂| 美腿丝袜亚洲综合| 欧美一级黄色大片| 成人av免费在线观看| 日本不卡1234视频| 亚洲宅男天堂在线观看无病毒| 日韩精品一区二区三区蜜臀| 一本到高清视频免费精品| 看电视剧不卡顿的网站| 夜夜爽夜夜爽精品视频| 中文字幕制服丝袜成人av | 成人午夜在线视频| 青青草97国产精品免费观看 | 久久这里只有精品视频网| 欧美日韩一二三| aaa国产一区| 国产**成人网毛片九色| 久久 天天综合| 人人超碰91尤物精品国产| 一二三区精品视频| 亚洲男帅同性gay1069| 国产农村妇女毛片精品久久麻豆 | 亚洲一区二区三区四区中文字幕 | 亚洲视频一区二区在线| 亚洲国产成人午夜在线一区| 久久久亚洲欧洲日产国码αv| 91精品免费在线| 欧美三级资源在线| 欧美性xxxxx极品少妇| 色综合色狠狠综合色| 99亚偷拍自图区亚洲| 成人福利视频网站| 国产剧情一区二区三区| 国产一区二区三区在线观看免费视频| 美女性感视频久久| 久久精品国产精品亚洲红杏| 美女久久久精品| 狂野欧美性猛交blacked| 美女www一区二区| 精品在线免费观看| 极品少妇xxxx偷拍精品少妇| 国内精品国产成人| 国产v日产∨综合v精品视频| 国产大片一区二区| 成人黄色片在线观看| 成人sese在线| 色婷婷综合久久久中文一区二区| 91丨国产丨九色丨pron| 在线亚洲+欧美+日本专区| 日本二三区不卡| 欧美理论片在线| 日韩免费观看2025年上映的电影| 精品捆绑美女sm三区| 国产亚洲女人久久久久毛片| 亚洲国产激情av| 亚洲精选一二三| 亚洲777理论| 久久99精品久久久久婷婷| 成人综合婷婷国产精品久久| 99精品视频一区二区三区| 欧美性色欧美a在线播放| 91麻豆精品国产无毒不卡在线观看| 日韩欧美综合一区| 国产精品免费网站在线观看| 亚洲欧美韩国综合色| 日韩精品久久久久久| 国产伦精品一区二区三区免费迷 | 国产高清在线观看免费不卡| 成人高清免费在线播放| 欧美性猛交一区二区三区精品| 91精品视频网| 国产精品视频免费看| 亚洲综合无码一区二区| 久久国产尿小便嘘嘘| av电影一区二区| 日韩一区二区三区观看| 亚洲国产精品激情在线观看| 亚洲风情在线资源站| 国内精品嫩模私拍在线| 日本道精品一区二区三区| 日韩欧美第一区| 亚洲欧美日韩精品久久久久| 蜜臀久久久99精品久久久久久| 成人开心网精品视频| 7777精品伊人久久久大香线蕉超级流畅| 精品国产麻豆免费人成网站| 伊人性伊人情综合网| 国内成人精品2018免费看| 日本韩国一区二区三区视频| 久久久青草青青国产亚洲免观| 一区二区三区在线视频观看58| 极品少妇xxxx偷拍精品少妇| 欧美吞精做爰啪啪高潮| 国产精品入口麻豆原神| 麻豆精品国产传媒mv男同| 日本高清免费不卡视频| 国产人成亚洲第一网站在线播放| 亚洲国产欧美在线人成| 成人午夜视频福利| 精品国产乱子伦一区| 亚洲一区二区成人在线观看| 成熟亚洲日本毛茸茸凸凹| 日韩西西人体444www| 亚洲精品日产精品乱码不卡| 国产精品1区二区.| 欧美一级欧美三级| 亚洲一二三区视频在线观看| 99精品桃花视频在线观看| 久久久精品国产免大香伊| 天天综合色天天综合| 97久久久精品综合88久久| 久久久久久电影| 玖玖九九国产精品| 8x8x8国产精品| 亚洲国产精品久久久久秋霞影院| 91麻豆文化传媒在线观看| 久久久国产综合精品女国产盗摄| 日本欧美加勒比视频| 欧美日韩中文字幕一区二区| 亚洲手机成人高清视频| www.亚洲人| 国产精品久久久久久久久免费相片 | 久久看人人爽人人| 久久电影网电视剧免费观看| 91精品国产一区二区三区蜜臀 | 日本一区二区免费在线观看视频 | 国产精品1区二区.| 久久久午夜精品理论片中文字幕| 久久精品999| 欧美电视剧在线观看完整版| 热久久久久久久| 这里只有精品免费| 婷婷久久综合九色综合绿巨人| 在线观看一区不卡| 亚洲香肠在线观看| 欧美久久久一区| 日本欧美久久久久免费播放网| 欧美一区二区视频在线观看2020 | 国产精品欧美综合在线| 成人丝袜18视频在线观看| 国产精品人人做人人爽人人添| 成人av在线网站| ...中文天堂在线一区| 日本精品一区二区三区高清| 亚洲综合另类小说| 91精品国产色综合久久| 久久精品国产秦先生| 久久久久国产精品麻豆ai换脸| 国产高清久久久| 国产精品美女久久久久aⅴ| 成人av网站在线| 亚洲精品国产一区二区三区四区在线 | 国产精品久久久久久久久免费相片| 9i看片成人免费高清| 亚洲一区免费观看| 717成人午夜免费福利电影| 久久精品国产一区二区三区免费看 | 国产呦萝稀缺另类资源| 久久久精品国产99久久精品芒果| 成人精品免费看| 一区二区三区欧美激情| 56国语精品自产拍在线观看| 精品一区二区国语对白| 国产网站一区二区| 在线免费不卡视频| 免费观看久久久4p| 国产精品欧美一区喷水| 欧美写真视频网站| 久久成人麻豆午夜电影| 国产精品久久久久毛片软件| 欧美日韩在线三级| 国产一本一道久久香蕉| 亚洲综合偷拍欧美一区色| 日韩一级大片在线观看| 成人国产精品视频| 亚洲高清在线精品| 国产三级欧美三级| 欧美三级中文字幕在线观看| 国产精品一区二区久久精品爱涩| 亚洲视频免费观看| 日韩欧美一级二级三级久久久| 99国产精品一区| 久久99久久99| 亚洲狠狠丁香婷婷综合久久久| 精品国产精品一区二区夜夜嗨| 91久久久免费一区二区| 国产精品1024| 亚洲图片欧美一区| 中文字幕精品一区二区三区精品| 欧美日韩国产天堂| 不卡的电影网站| 激情亚洲综合在线| 亚洲午夜电影在线观看| 亚洲国产精品黑人久久久| 欧美一区二区精美| 91麻豆文化传媒在线观看| 国产乱人伦偷精品视频不卡| 午夜精品久久久久久久99水蜜桃| 国产精品理论在线观看| 久久综合色鬼综合色|