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

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

?? searchtag.java

?? jakarta-taglibs
?? JAVA
字號:
/*
 * 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.taglibs.jndi;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.naming.*;
import javax.naming.directory.*;

import java.io.*;

/**
 *
 * @author  Danno Ferrin <shemnon@earthlink.net>
 * @version $Revision: 1.4 $
 */
public class SearchTag extends BodyTagSupport {

    private int scope = PageContext.PAGE_SCOPE;
    private String attributes;
    private String attributeSeparator = ",";
    private SearchControls controls;
    private DirContext context;
    private String contextRef;
    private String filter;
    private NamingEnumeration nameEnum;
    private SearchResult currentResult;
    private String name = "";
    private Name nameObject;

    /** Creates new SearchTag */
    public SearchTag() {
    }

    public void setPageContext(PageContext pc) {
        controls = new SearchControls();
        super.setPageContext(pc);
    }

    /**
     * Setter for property scope.
     * @param Scope New value of property scope.
     */
    public void setScope(String scope) {
        this.scope = decodeScope(scope);
    }

    /**
     * Getter for property context.
     * @return Value of property context.
     */
    public DirContext getContext() {
        return context;
    }

    /**
     * Setter for property context.
     * @param context New value of property context.
     */
    public void setContext(DirContext context) {
        this.context = context;
    }

    /**
     * Setter for property contextRef.
     * @param contextRef New value of property contextRef.
     */
    public void setContextRef(String contextRef) {
        this.contextRef = contextRef;
    }

    /**
     * Getter for property `.
     * @return Value of property name.
     */
    public String getName() {
        return name;
    }

    /**
     * Setter for property name.
     * @param name New value of property name.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Getter for property nameObject.
     * @return Value of property nameObject.
     */
    public Name getNameObject() {
        return nameObject;
    }

    /**
     * Setter for property nameObject.
     * @param nameObject New value of property nameObject.
     */
    public void setNameObject(Name nameObject) {
        this.nameObject = nameObject;
    }

    /**
     * Getter for property filter.
     * @return Value of property filter.
     */
    public String getFilter() {
        return filter;
    }

    /**
     * Setter for property filter.
     * @param filter New value of property filter.
     */
    public void setFilter(String filter) {
        this.filter = filter;
    }

    /**
     * Getter for property countLimit.
     * @return Value of property countLimit.
     */
    public long getCountLimit() {
        return controls.getCountLimit();
    }

    /**
     * Setter for property countLimit.
     * @param countLimit New value of property countLimit.
     */
    public void setCountLimit(long countLimit) {
        controls.setCountLimit(countLimit);
    }

    /**
     * Getter for property derefLink.
     * @return Value of property derefLink.
     */
    public boolean getDerefLink() {
        return controls.getDerefLinkFlag();
    }

    /**
     * Setter for property derefLink.
     * @param derefLink New value of property derefLink.
     */
    public void setDerefLink(boolean derefLink) {
        controls.setDerefLinkFlag(derefLink);
    }

    /**
     * Getter for property attributes.
     * @return Value of property attributes.
     */
    public String getAttributes() {
        return attributes;
    }

    /**
     * Setter for property attributes.
     * @param attributes New value of property attributes.
     */
    public void setAttributes(String attributes) {
        this.attributes = attributes;
    }

    /**
     * Getter for property attributeSeparator.
     * @return Value of property attrbuteSeparator.
     */
    public String getAttributeSeparator() {
        return attributeSeparator;
    }

    /**
     * Setter for property attributeSeparator.
     * @param attrbuteSeparator New value of property attrbuteSeparator.
     */
    public void setAttributeSeparator(String attributeSeparator) {
        this.attributeSeparator = attributeSeparator;
    }

    /**
     * Getter for property bindings.
     * @return Value of property bindings.
     */
    public boolean getBindings() {
        return controls.getReturningObjFlag();
    }

    /**
     * Setter for property bindings.
     * @param bindings New value of property bindings.
     */
    public void setBindings(boolean bindings) {
        controls.setReturningObjFlag(bindings);
    }

    /**
     * Getter for property searchScope.
     * @return Value of property searchScope.
     */
    public String getSearchScope() {
        return decodeSearchScope(controls.getSearchScope());    
    }

    /**
     * Setter for property searchScope.
     * @param searchScope New value of property searchScope.
     */
    public void setSearchScope(String searchScope) {
        controls.setSearchScope(decodeSearchScope(searchScope));
    }

    /**
     * Getter for property timeLimit.
     * @return Value of property timeLimit.
     */
    public int getTimeLimit() {
        return controls.getTimeLimit();
    }

    /**
     * Setter for property timeLimit.
     * @param timeLimit New value of property timeLimit.
     */
    public void setTimeLimit(int timeLimit) {
        controls.setTimeLimit(timeLimit);
    }
    
    public int doStartTag() throws JspException {
        // Initialize invocation variables
        nameEnum = null;

        if( contextRef != null ) {
            context = null;
            Object o = pageContext.findAttribute(contextRef);
            if (o instanceof DirContext) {
                context = (DirContext) o;
            } else if (o instanceof Context) {
                try {
                    // attempt a blank lookup
                    o = ((Context)o).lookup("");
                    if (o instanceof DirContext) {
                        context = (DirContext) o;
                    }
                } catch (NamingException ne) {
                    // oh well, it failed, toss it out
                }
            }
        }
        if( context == null ) {
            throw new JspException("JNDI search tag could not find a context");
        }
        String[] attrs = null;
        if (attributes != null) {
            if (attributes.length() == 0) {
                attrs = new String[0];
            } else {
                int count = 1;
                int i=0, j=0, size = attributeSeparator.length();
                while ((j=attributes.indexOf(attributeSeparator, i)) != -1) {
                    count++;
                    i = j + size;
                }
                attrs = new String[count];
                count = 0;
                i = 0;
                while ((j=attributes.indexOf(attributeSeparator, i)) != -1) {
                    attrs[count] = attributes.substring(i, j);
                    count++;
                    i = j + size;
                }
                attrs[count] = attributes.substring(i);
            }
        }
        
        controls.setReturningAttributes(attrs);

        try {
            if (nameObject != null) {
                nameEnum = context.search(nameObject, filter, controls);
            } else {
                nameEnum = context.search(name, filter, controls);
            }
        } catch (NamingException ne) {
            throw new JspException("JNDI search tag failed: "+ne.getMessage());
        }
        
        if (nameEnum.hasMoreElements()) {
            return EVAL_BODY_TAG;
        } else {
            return SKIP_BODY;
        }
    }
    
    public void doInitBody() {
        currentResult = (SearchResult) nameEnum.nextElement();
        if (getId() != null) {
            pageContext.setAttribute(getId(),
                    currentResult, scope);
        }
    }
        
    public int doAfterBody() {
        if (! nameEnum.hasMoreElements()) {
            return SKIP_BODY;
        } else {
            currentResult = (SearchResult) nameEnum.nextElement();
            if (getId() != null) {
                pageContext.setAttribute(getId(),
                        currentResult, scope);
            }
            return EVAL_BODY_TAG;
        }
    }
    
    public int doEndTag() throws JspException {
        try {
            if (bodyContent != null) {
                bodyContent.writeOut(pageContext.getOut());
            }
        } catch (IOException ioe) {
            throw new JspException(ioe.toString());
        }
        try {
            nameEnum.close();
        } catch (NamingException ne) {
            throw new JspException(ne.toString());
        }
        return EVAL_PAGE;
    }
    
    public static int decodeSearchScope(String scope) {
        // a better way would be to pop a hashtable with Integer as value
        if ("object_scope".equalsIgnoreCase(scope) || 
            "object".equalsIgnoreCase(scope)) {
            return SearchControls.OBJECT_SCOPE;
        } else if ("onelevel_scope".equalsIgnoreCase(scope) ||
                   "onelevel".equalsIgnoreCase(scope)) {
            return SearchControls.ONELEVEL_SCOPE;
        } else if ("subtree_scope".equalsIgnoreCase(scope) ||
                   "subtree".equalsIgnoreCase(scope)) {
            return SearchControls.SUBTREE_SCOPE;
        } else {
            return -1;
        }
    }
    
    public static String decodeSearchScope(int scope) {
        switch (scope) {
            case SearchControls.OBJECT_SCOPE:
                return "OBJECT_SCOPE";
            case SearchControls.ONELEVEL_SCOPE:
                return "ONELEVEL_SCOPE";
            case SearchControls.SUBTREE_SCOPE:
                return "SUBTREE_SCOPE";
            default:
                return null;
        }
    }

    public static int decodeScope(String scope) {
        if (scope.equalsIgnoreCase("request")) {
            return PageContext.REQUEST_SCOPE;
        } else if (scope.equalsIgnoreCase("session")) {
            return PageContext.SESSION_SCOPE;
        } else if (scope.equalsIgnoreCase("application")) {
            return PageContext.APPLICATION_SCOPE;
        } else {
            return PageContext.PAGE_SCOPE;
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜精品在线| 亚洲在线视频免费观看| 国产精品网站在线观看| **欧美大码日韩| 视频一区欧美日韩| 国产在线精品国自产拍免费| 成人app下载| 欧美日本在线观看| 亚洲精品一区二区三区精华液 | 日韩精品一二区| 黄色小说综合网站| 91在线码无精品| 在线综合+亚洲+欧美中文字幕| 国产亚洲一区二区三区在线观看| 亚洲精品菠萝久久久久久久| 蜜桃传媒麻豆第一区在线观看| 成人毛片老司机大片| 欧美日韩一本到| 国产欧美精品在线观看| 亚洲二区在线观看| 风间由美中文字幕在线看视频国产欧美| 色视频欧美一区二区三区| 精品乱码亚洲一区二区不卡| 亚洲免费观看在线观看| 久久9热精品视频| 91美女蜜桃在线| 欧美精品一区二区三区四区| 亚洲高清在线视频| www.99精品| 精品国产sm最大网站| 亚洲一区二区三区四区在线免费观看 | 精彩视频一区二区| 欧美亚洲自拍偷拍| 一区免费观看视频| 国产精品一品二品| 欧美一级爆毛片| 一片黄亚洲嫩模| 成人激情小说网站| 久久久亚洲精品一区二区三区| 亚洲成a人片综合在线| 99国产精品国产精品久久| 精品国产乱码久久久久久牛牛| 亚洲一区在线视频观看| 不卡的电影网站| 久久久精品一品道一区| 捆绑调教一区二区三区| 制服.丝袜.亚洲.中文.综合| 亚洲精品视频免费看| 成人性生交大片| 久久精品视频免费| 麻豆91在线看| 777欧美精品| 亚洲国产cao| 在线免费av一区| 亚洲人成网站色在线观看| 国产成人av电影免费在线观看| 精品日韩欧美在线| 美女爽到高潮91| 日韩欧美在线影院| 日韩成人精品视频| 日韩一级免费观看| 免费一级欧美片在线观看| 欧美日韩一二三| 亚洲成人一区在线| 欧美日韩综合在线| 午夜私人影院久久久久| 欧美色欧美亚洲另类二区| 一区二区三区在线观看欧美| 在线看国产一区二区| 一区二区三区小说| 91黄色小视频| 五月天一区二区三区| 欧美日韩在线精品一区二区三区激情| 亚洲综合久久av| 欧美日韩免费一区二区三区| 午夜国产不卡在线观看视频| 欧美日韩视频在线第一区| 日韩高清一区在线| 日韩亚洲欧美高清| 久久av老司机精品网站导航| 久久久亚洲国产美女国产盗摄| 国产成人在线看| 国产精品久久夜| 色老汉av一区二区三区| 亚洲午夜在线观看视频在线| 欧美电影一区二区三区| 青青青伊人色综合久久| 欧美va亚洲va| 大陆成人av片| 一区二区三区四区激情| 欧美日本乱大交xxxxx| 久久精品国产精品青草| 久久综合九色综合97婷婷 | 中文字幕一区二区日韩精品绯色 | 亚洲一区二区三区爽爽爽爽爽| 欧美日韩中文字幕精品| 日本在线不卡视频一二三区| 精品女同一区二区| 成人99免费视频| 亚洲一二三级电影| 精品久久久久一区二区国产| 国产99久久久国产精品免费看| √…a在线天堂一区| 7777精品伊人久久久大香线蕉 | 国产亚洲女人久久久久毛片| k8久久久一区二区三区 | 欧美一区二区三区性视频| 国产一区二区三区美女| 亚洲男人的天堂av| 在线电影欧美成精品| 国产呦萝稀缺另类资源| 中文字幕中文字幕一区| 欧美日本视频在线| 成人免费观看av| 亚洲 欧美综合在线网络| 2020国产精品| 在线视频欧美区| 国产美女精品一区二区三区| 一区二区三区久久久| 欧美本精品男人aⅴ天堂| 久久久久久毛片| 成人av在线播放网站| 日韩不卡在线观看日韩不卡视频| 日本一区二区三区在线观看| 精品视频1区2区3区| 国产精品一区二区男女羞羞无遮挡| 亚洲男人的天堂在线aⅴ视频| 精品裸体舞一区二区三区| 91视视频在线观看入口直接观看www | av中文字幕亚洲| 久久精品国产亚洲5555| 亚洲欧美日韩国产手机在线 | 国产成人一区二区精品非洲| 亚洲电影第三页| 欧美高清在线视频| 日韩一区二区中文字幕| 91麻豆精品视频| 国产成人小视频| 欧美96一区二区免费视频| 亚洲精品免费在线| 国产女主播在线一区二区| 欧美一二三区精品| 在线免费一区三区| 99久久伊人网影院| 国内精品久久久久影院一蜜桃| 午夜久久久影院| 一区二区三区在线视频免费观看| 国产欧美精品一区二区三区四区| 日韩欧美在线123| 欧美探花视频资源| 99re这里只有精品6| 国产v日产∨综合v精品视频| 久久精品国产一区二区三| 亚洲国产视频在线| 亚洲天堂福利av| 中文字幕va一区二区三区| 久久色中文字幕| 日韩一区和二区| 欧美一区二区三区公司| 欧美性xxxxx极品少妇| 99视频超级精品| 成人免费观看男女羞羞视频| 国产一区二区在线影院| 麻豆视频观看网址久久| 五月激情六月综合| 亚洲国产精品久久不卡毛片 | 欧美日韩一区二区三区在线| 91在线你懂得| 99精品视频一区二区| a亚洲天堂av| av高清久久久| 粗大黑人巨茎大战欧美成人| 国产成人精品一区二区三区网站观看| 老司机一区二区| 狠狠色伊人亚洲综合成人| 久久超碰97中文字幕| 蜜芽一区二区三区| 免费在线观看不卡| 久久精品免费观看| 国产自产高清不卡| 国产精品亚洲а∨天堂免在线| 国产一区在线观看麻豆| 国产乱国产乱300精品| 国产一区二区免费看| 国产盗摄女厕一区二区三区| 国产91精品久久久久久久网曝门| 国产不卡在线视频| 成人免费观看视频| 91麻豆精东视频| 欧美日韩一级视频| 欧美精品99久久久**| 欧美一二三四区在线| 久久女同精品一区二区| 欧美激情一区二区三区| 国产精品久久国产精麻豆99网站| 中文字幕在线观看不卡| 一区二区三区高清| 天天射综合影视| 久久99国产精品久久99| 国产.欧美.日韩|