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

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

?? tagutils.java

?? struts的源代碼
?? JAVA
字號:
/*
 * $Id: TagUtils.java 54929 2004-10-16 16:38:42Z germuska $ 
 *
 * 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.tiles.util;

import java.lang.reflect.InvocationTargetException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.Globals;
import org.apache.struts.taglib.tiles.ComponentConstants;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.ComponentDefinition;
import org.apache.struts.tiles.DefinitionsFactoryException;
import org.apache.struts.tiles.FactoryNotFoundException;
import org.apache.struts.tiles.NoSuchDefinitionException;
import org.apache.struts.tiles.TilesUtil;

/**
 * Collection of utilities.
 * This class also serves as an interface between Components and Struts. If
 * you want to rip away Struts, simply reimplement some methods in this class.
 * You can copy them from Struts.
 * 
 */
public class TagUtils {

    /** Debug flag */
    public static final boolean debug = true;
    
    /**
    * Get scope value from string value
    * @param scopeName Scope as a String.
    * @param defaultValue Returned default value, if not found.
    * @return Scope as an <code>int</code>, or <code>defaultValue</code> if scope is <code>null</code>.
    * @throws JspException Scope name is not recognized as a valid scope.
    */
    public static int getScope(String scopeName, int defaultValue) throws JspException {
        if (scopeName == null) {
            return defaultValue;
        }
        
        if (scopeName.equalsIgnoreCase("component")) {
            return ComponentConstants.COMPONENT_SCOPE;
            
        } else if (scopeName.equalsIgnoreCase("template")) {
            return ComponentConstants.COMPONENT_SCOPE;
            
        } else if (scopeName.equalsIgnoreCase("tile")) {
            return ComponentConstants.COMPONENT_SCOPE;
            
        } else {
            return org.apache.struts.taglib.TagUtils.getInstance().getScope(
                scopeName);
        }
    }

    /**
     * Return the value of the specified property of the specified bean,
     * no matter which property reference format is used, with no
     * type conversions.
     *
     * @param bean Bean whose property is to be extracted.
     * @param name Possibly indexed and/or nested name of the property
     *  to be extracted.
     *
     * @exception IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @exception InvocationTargetException if the property accessor method
     *  throws an exception
     * @exception NoSuchMethodException if an accessor method for this
     *  propety cannot be found.
     * @deprecated Use PropertyUtils.getProperty() directly.  This will be removed
     * after Struts 1.2.
     */
	public static Object getProperty(Object bean, String name)
		throws
			IllegalAccessException,
			InvocationTargetException,
			NoSuchMethodException {

		return PropertyUtils.getProperty(bean, name);
	}

    /**
     * Retrieve bean from page context, using specified scope.
     * If scope is not set, use <code>findAttribute()</code>.
     *
     * @param beanName Name of bean to retrieve.
     * @param scopeName Scope or <code>null</code>. If <code>null</code>, bean is searched using
     *  findAttribute().
     * @param pageContext Current pageContext.
     * @return Requested bean or <code>null</code> if not found.
     * @throws JspException Scope name is not recognized as a valid scope.
     */
    public static Object retrieveBean(String beanName, String scopeName, PageContext pageContext)
        throws JspException {
        
        if (scopeName == null) {
            return findAttribute(beanName, pageContext);
        }

        // Default value doesn't matter because we have already check it
        int scope = getScope(scopeName, PageContext.PAGE_SCOPE);
        
        //return pageContext.getAttribute( beanName, scope );
        return getAttribute(beanName, scope, pageContext);
    }

    /**
     * Search attribute in different contexts.
     * First, check in component context, then use pageContext.findAttribute().
     * @param beanName Name of bean to retrieve.
     * @param pageContext Current pageContext.
     * @return Requested bean or <code>null</code> if not found.
     */
    public static Object findAttribute(String beanName, PageContext pageContext) {
        ComponentContext compContext = ComponentContext.getContext(pageContext.getRequest());
        
        if (compContext != null) {
            Object attribute = compContext.findAttribute(beanName, pageContext);
            if (attribute != null) {
                return attribute;
            }
        }

        // Search in pageContext scopes
        return pageContext.findAttribute(beanName);
    }

    /**
     * Get object from requested context. Return <code>null</code> if not found.
     * Context can be "component" or normal JSP contexts.
     * @param beanName Name of bean to retrieve.
     * @param scope Scope from which bean must be retrieved.
     * @param pageContext Current pageContext.
     * @return Requested bean or <code>null</code> if not found.
     */
    public static Object getAttribute(String beanName, int scope, PageContext pageContext) {
        if (scope == ComponentConstants.COMPONENT_SCOPE) {
            ComponentContext compContext = ComponentContext.getContext(pageContext.getRequest());
            return compContext.getAttribute(beanName);
        }
        return pageContext.getAttribute(beanName, scope);
    }

    /**
     * Locate and return the specified property of the specified bean, from
     * an optionally specified scope, in the specified page context.
     *
     * @param pageContext Page context to be searched.
     * @param beanName Name of the bean to be retrieved.
     * @param beanProperty Name of the property to be retrieved, or
     *  <code>null</code> to retrieve the bean itself.
     * @param beanScope Scope to be searched (page, request, session, application)
     *  or <code>null</code> to use <code>findAttribute()</code> instead.
     *
     * @exception JspException Scope name is not recognized as a valid scope
     * @exception JspException if the specified bean is not found
     * @exception JspException if accessing this property causes an
     *  IllegalAccessException, IllegalArgumentException,
     *  InvocationTargetException, or NoSuchMethodException
     */
    public static Object getRealValueFromBean(
        String beanName,
        String beanProperty,
        String beanScope,
        PageContext pageContext)
        throws JspException {
            
        try {
            Object realValue;
            Object bean = retrieveBean(beanName, beanScope, pageContext);
            if (bean != null && beanProperty != null) {
                realValue = PropertyUtils.getProperty(bean, beanProperty);
            } else {
                realValue = bean; // value can be null
            }
            return realValue;
            
        } catch (NoSuchMethodException ex) {
            throw new JspException(
                "Error - component.PutAttributeTag : Error while retrieving value from bean '"
                    + beanName
                    + "' with property '"
                    + beanProperty
                    + "' in scope '"
                    + beanScope
                    + "'. (exception : "
                    + ex.getMessage());
                    
        } catch (InvocationTargetException ex) {
            throw new JspException(
                "Error - component.PutAttributeTag : Error while retrieving value from bean '"
                    + beanName
                    + "' with property '"
                    + beanProperty
                    + "' in scope '"
                    + beanScope
                    + "'. (exception : "
                    + ex.getMessage());
                    
        } catch (IllegalAccessException ex) {
            throw new JspException(
                "Error - component.PutAttributeTag : Error while retrieving value from bean '"
                    + beanName
                    + "' with property '"
                    + beanProperty
                    + "' in scope '"
                    + beanScope
                    + "'. (exception : "
                    + ex.getMessage());
        }
    }

    /**
     * Store bean in requested context.
     * If scope is <code>null</code>, save it in REQUEST_SCOPE context.
     *
     * @param pageContext Current pageContext.
     * @param name Name of the bean.
     * @param scope Scope under which bean is saved (page, request, session, application)
     *  or <code>null</code> to store in <code>request()</code> instead.
     * @param value Bean value to store.
     *
     * @exception JspException Scope name is not recognized as a valid scope
     */
    public static void setAttribute(
        PageContext pageContext,
        String name,
        Object value,
        String scope)
        throws JspException {
            
        if (scope == null)
            pageContext.setAttribute(name, value, PageContext.REQUEST_SCOPE);
        else if (scope.equalsIgnoreCase("page"))
            pageContext.setAttribute(name, value, PageContext.PAGE_SCOPE);
        else if (scope.equalsIgnoreCase("request"))
            pageContext.setAttribute(name, value, PageContext.REQUEST_SCOPE);
        else if (scope.equalsIgnoreCase("session"))
            pageContext.setAttribute(name, value, PageContext.SESSION_SCOPE);
        else if (scope.equalsIgnoreCase("application"))
            pageContext.setAttribute(name, value, PageContext.APPLICATION_SCOPE);
        else {
            throw new JspException("Error - bad scope name '" + scope + "'");
        }
    }

    /**
     * Store bean in REQUEST_SCOPE context.
     *
     * @param pageContext Current pageContext.
     * @param name Name of the bean.
     * @param beanValue Bean value to store.
     *
     * @exception JspException Scope name is not recognized as a valid scope
     */
    public static void setAttribute(PageContext pageContext, String name, Object beanValue)
        throws JspException {
        pageContext.setAttribute(name, beanValue, PageContext.REQUEST_SCOPE);
    }

    /**
     * Save the specified exception as a request attribute for later use.
     *
     * @param pageContext The PageContext for the current page.
     * @param exception The exception to be saved.
     */
    public static void saveException(PageContext pageContext, Throwable exception) {
        pageContext.setAttribute(Globals.EXCEPTION_KEY, exception, PageContext.REQUEST_SCOPE);
    }

    /**
     * Get component definition by its name.
     * @param name Definition name.
     * @param pageContext The PageContext for the current page.
     * @throws JspException -
     */
    public static ComponentDefinition getComponentDefinition(String name, PageContext pageContext)
        throws JspException {
            
        try {
            return TilesUtil.getDefinition(
                name,
                pageContext.getRequest(),
                pageContext.getServletContext());
                
        } catch (NoSuchDefinitionException ex) {
            throw new JspException(
                "Error : Can't get component definition for '"
                    + name
                    + "'. Check if this name exist in component definitions.");
        } catch (FactoryNotFoundException ex) { // factory not found.
            throw new JspException(ex.getMessage());
            
        } catch (DefinitionsFactoryException ex) {
            if (debug)
                ex.printStackTrace();
            // Save exception to be able to show it later
            saveException(pageContext, ex);
            throw new JspException(ex.getMessage());
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区啦啦啦在线观看| ...av二区三区久久精品| 欧美极品美女视频| 亚洲一区中文在线| 国产成a人亚洲精| 欧美日韩精品欧美日韩精品| 国产午夜亚洲精品午夜鲁丝片| 亚洲国产精品一区二区久久 | zzijzzij亚洲日本少妇熟睡| 91精品国产一区二区三区蜜臀| 亚洲欧美影音先锋| 国产a久久麻豆| 精品国产第一区二区三区观看体验| 亚洲人妖av一区二区| 国产精品系列在线播放| 日韩午夜精品视频| 五月天激情小说综合| 精品国产91乱码一区二区三区| 亚洲精品一区二区三区精华液| 亚洲在线视频一区| 一区二区三区91| 国产一区中文字幕| 日韩免费看的电影| 三级精品在线观看| 欧美日韩激情一区二区| 夜夜精品浪潮av一区二区三区| 不卡的电影网站| 国产精品日韩精品欧美在线| 国产精品中文有码| 久久蜜桃av一区精品变态类天堂 | 亚洲欧美日韩小说| 不卡视频免费播放| 最新国产の精品合集bt伙计| 懂色一区二区三区免费观看| 久久网这里都是精品| 国产在线精品一区二区不卡了 | 欧美福利视频一区| 视频一区中文字幕国产| 777午夜精品视频在线播放| 亚洲国产日韩a在线播放性色| 欧美在线免费播放| 婷婷激情综合网| 欧美一区二区三区不卡| 久久丁香综合五月国产三级网站 | 中文字幕亚洲区| 91精彩视频在线观看| 一区二区三区在线看| 精品视频一区三区九区| 日韩精彩视频在线观看| 欧美一级二级三级乱码| 久久99精品久久久久久动态图 | 国产超碰在线一区| 亚洲色图制服诱惑| 欧美日韩一区二区在线观看| 午夜欧美电影在线观看| 成人网在线免费视频| 精品电影一区二区| 国产精品77777| 亚洲男人的天堂一区二区 | 欧美日韩一卡二卡| 美女视频免费一区| 欧美一二三四区在线| 粉嫩绯色av一区二区在线观看| 国产精品毛片久久久久久久| 色偷偷88欧美精品久久久| 一区二区三区精密机械公司| 欧美一二三在线| 国产不卡免费视频| 夜夜揉揉日日人人青青一国产精品 | 久久av资源站| 亚洲手机成人高清视频| 欧美唯美清纯偷拍| 国产精品综合二区| 亚洲三级免费电影| 久久影院视频免费| 91亚洲永久精品| 激情另类小说区图片区视频区| 国产欧美日韩不卡| 日韩一区二区三区在线| 国产91综合一区在线观看| 亚洲香蕉伊在人在线观| 精品美女一区二区| 欧美三级一区二区| 国产美女在线观看一区| 亚洲第一综合色| 国产午夜精品美女毛片视频| 欧美色视频在线观看| 国产激情精品久久久第一区二区| 亚洲狠狠爱一区二区三区| 久久女同精品一区二区| 免费观看30秒视频久久| 日韩理论电影院| 欧美一区二区视频网站| 91福利国产成人精品照片| 国产精品亚洲一区二区三区妖精| 中文字幕一区二区三区av| 欧美一级二级三级蜜桃| 欧美日韩精品三区| 成人在线视频一区| 亚洲国产wwwccc36天堂| 欧美激情一区二区三区不卡| 色成年激情久久综合| 国产精品亚洲成人| 欧美激情一区二区三区四区 | 91成人免费在线| 日av在线不卡| 亚洲成人免费影院| 国产亚洲精品aa| 精品美女一区二区| 麻豆精品久久精品色综合| 精品一区在线看| 国产精品传媒入口麻豆| 久久伊人蜜桃av一区二区| 91久久一区二区| 色婷婷综合中文久久一本| 国产成人午夜精品影院观看视频 | 7777精品伊人久久久大香线蕉的| 一本色道综合亚洲| www.日韩精品| 99re这里只有精品6| 国产成人一级电影| 国产精品一区二区在线观看网站| 亚洲超碰精品一区二区| 一区二区三区日韩精品视频| 国产精品国产三级国产有无不卡| 久久精品视频在线免费观看 | 欧美美女一区二区在线观看| 成人18精品视频| 国产一区二区毛片| 亚洲一区国产视频| 亚洲电影视频在线| 亚洲成人777| 日韩精品午夜视频| 亚洲一区免费在线观看| 亚洲va韩国va欧美va精品| 亚洲成人三级小说| 日韩电影在线一区二区| 亚洲已满18点击进入久久| 午夜精品久久久久久久久久久| 亚洲国产一区视频| 日本欧美大码aⅴ在线播放| 男女激情视频一区| 日日摸夜夜添夜夜添国产精品| 日韩va欧美va亚洲va久久| 美女在线视频一区| 国产一区在线观看麻豆| 成+人+亚洲+综合天堂| 亚洲人亚洲人成电影网站色| 国产一区二区免费视频| 狠狠色伊人亚洲综合成人| 久久电影网电视剧免费观看| 国产永久精品大片wwwapp| 亚洲观看高清完整版在线观看| 亚洲香肠在线观看| 久久精品国产精品青草| 国产成人在线看| 97久久久精品综合88久久| 色欧美88888久久久久久影院| 欧洲亚洲精品在线| 91亚洲午夜精品久久久久久| 欧美精品 国产精品| 欧美成人在线直播| 久久综合中文字幕| 国产精品麻豆99久久久久久| 亚洲综合在线视频| 麻豆精品视频在线观看| 成人黄色一级视频| 99国产精品久| 欧美一区永久视频免费观看| 国产精品色噜噜| 亚洲国产成人av好男人在线观看| 精品亚洲成a人| 成人免费毛片嘿嘿连载视频| 亚洲美女免费视频| 国产蜜臀av在线一区二区三区| 中文字幕在线免费不卡| 日韩黄色免费电影| www.亚洲激情.com| 成人免费高清视频| 精品久久久久香蕉网| 伊人色综合久久天天人手人婷| 老司机午夜精品| 97久久人人超碰| 国产精品久久久久精k8 | 婷婷中文字幕一区三区| 国产成a人亚洲| 91精品国产免费| 色偷偷88欧美精品久久久| 欧美r级在线观看| 亚洲激情在线播放| 免费在线成人网| 成人午夜伦理影院| 欧美精品 日韩| 一区二区在线免费| av不卡在线观看| 久久午夜羞羞影院免费观看| 天天免费综合色| 成人福利在线看| 欧美丝袜丝nylons| 亚洲免费色视频|