當前位置: 首頁>>代碼示例>>Java>>正文


Java ELContext.getContext方法代碼示例

本文整理匯總了Java中javax.el.ELContext.getContext方法的典型用法代碼示例。如果您正苦於以下問題:Java ELContext.getContext方法的具體用法?Java ELContext.getContext怎麽用?Java ELContext.getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.el.ELContext的用法示例。


在下文中一共展示了ELContext.getContext方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:20,代碼來源:ScopedAttributeELResolver.java

示例2: setValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:25,代碼來源:ScopedAttributeELResolver.java

示例3: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, 
                       Object property)
{
  if (base == null)
  {
    if (property == null)
      return null;
    FacesContext fc = (FacesContext) context.getContext(FacesContext.class);
    return _vr.resolveVariable(fc, property.toString());
  }
  else
  {
    if (_isIndexed(base))
      return _pr.getValue(base, _getIndex(property));
    else
      return _pr.getValue(base, property);      
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:20,代碼來源:MELResolver.java

示例4: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, Object property)
		throws NullPointerException, PropertyNotFoundException, ELException {
	if (context == null) {
		throw new NullPointerException();
	}

	if (base == null) {
		context.setPropertyResolved(true);
		if (property != null) {
			String key = property.toString();
			PageContext page = (PageContext) context.getContext(JspContext.class);
			return page.findAttribute(key);
		}
	}

	return null;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:19,代碼來源:ScopedAttributeELResolver.java

示例5: setValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public void setValue(ELContext context, Object base, Object property, Object value)
		throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
	if (context == null) {
		throw new NullPointerException();
	}

	if (base == null) {
		context.setPropertyResolved(true);
		if (property != null) {
			String key = property.toString();
			PageContext page = (PageContext) context.getContext(JspContext.class);
			int scope = page.getAttributesScope(key);
			if (scope != 0) {
				page.setAttribute(key, value, scope);
			} else {
				page.setAttribute(key, value);
			}
		}
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:22,代碼來源:ScopedAttributeELResolver.java

示例6: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());

        if (idx >= 0) {
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            context.setPropertyResolved(true);
            switch (idx) {
            case APPLICATIONSCOPE:
                return ScopeManager.get(page).getApplicationScope();
            case COOKIE:
                return ScopeManager.get(page).getCookie();
            case HEADER:
                return ScopeManager.get(page).getHeader();
            case HEADERVALUES:
                return ScopeManager.get(page).getHeaderValues();
            case INITPARAM:
                return ScopeManager.get(page).getInitParam();
            case PAGECONTEXT:
                return ScopeManager.get(page).getPageContext();
            case PAGESCOPE:
                return ScopeManager.get(page).getPageScope();
            case PARAM:
                return ScopeManager.get(page).getParam();
            case PARAM_VALUES:
                return ScopeManager.get(page).getParamValues();
            case REQUEST_SCOPE:
                return ScopeManager.get(page).getRequestScope();
            case SESSION_SCOPE:
                return ScopeManager.get(page).getSessionScope();
            }
        }
    }
    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:43,代碼來源:ImplicitObjectELResolver.java

示例7: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
/**
 * If the base object is <code>null</code>, searches the page, 
 * request, session and application scopes for an attribute with
 * the given name and returns it, or <code>null</code> if no
 * attribute exists with the current name.
 *
 * <p>The <code>propertyResolved</code> property of the 
 * <code>ELContext</code> object must be set to <code>true</code> by 
 * this resolver before returning if base is <code>null</code>. If 
 * this property is not <code>true</code> after this method is called,
 * the caller should ignore the return value.</p>
 *
 * @param context The context of this evaluation.
 * @param base Only <code>null</code> is handled by this resolver.
 *     Other values will result in an immediate return.
 * @param property The name of the scoped attribute to resolve.
 * @return If the <code>propertyResolved</code> property of 
 *     <code>ELContext</code> was set to <code>true</code>, then
 *     the scoped attribute; otherwise undefined.
 * @throws NullPointerException if context is <code>null</code>
 * @throws ELException if an exception was thrown while performing
 *     the property or variable resolution. The thrown exception
 *     must be included as the cause property of this exception, if
 *     available.
 */
public Object getValue(ELContext context,
                       Object base,
                       Object property) {

    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property instanceof String) {
            String attribute = (String) property;
            PageContext ctxt = (PageContext)
                                   context.getContext(JspContext.class);
            return ctxt.findAttribute(attribute);
        }
    }
    return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:45,代碼來源:ScopedAttributeELResolver.java

示例8: getValue

import javax.el.ELContext; //導入方法依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, Object property)
		throws NullPointerException, PropertyNotFoundException, ELException {
	if (context == null) {
		throw new NullPointerException();
	}

	if (base == null && property != null) {
		int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());

		if (idx >= 0) {
			PageContext page = (PageContext) context.getContext(JspContext.class);
			context.setPropertyResolved(true);
			switch (idx) {
			case APPLICATIONSCOPE:
				return ScopeManager.get(page).getApplicationScope();
			case COOKIE:
				return ScopeManager.get(page).getCookie();
			case HEADER:
				return ScopeManager.get(page).getHeader();
			case HEADERVALUES:
				return ScopeManager.get(page).getHeaderValues();
			case INITPARAM:
				return ScopeManager.get(page).getInitParam();
			case PAGECONTEXT:
				return ScopeManager.get(page).getPageContext();
			case PAGESCOPE:
				return ScopeManager.get(page).getPageScope();
			case PARAM:
				return ScopeManager.get(page).getParam();
			case PARAM_VALUES:
				return ScopeManager.get(page).getParamValues();
			case REQUEST_SCOPE:
				return ScopeManager.get(page).getRequestScope();
			case SESSION_SCOPE:
				return ScopeManager.get(page).getSessionScope();
			}
		}
	}
	return null;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:42,代碼來源:ImplicitObjectELResolver.java

示例9: setValue

import javax.el.ELContext; //導入方法依賴的package包/類
/**
 * If the base object is <code>null</code>, sets an existing scoped
 * attribute to the new value, or creates a new scoped attribute if one
 * does not exist by this name.
 *
 * <p>If the provided attribute name matches the key of an attribute 
 * in page scope, request scope, session scope, or application scope, the 
 * corresponding attribute value will be replaced by the provided value.
 * Otherwise, a new page scope attribute will be created with the
 * given name and value.</p>
 *
 * <p>The <code>propertyResolved</code> property of the 
 * <code>ELContext</code> object must be set to <code>true</code> by 
 * this resolver before returning if base is <code>null</code>. If 
 * this property is not <code>true</code> after this method is called,
 * the caller should ignore the return value.</p>
 *
 * @param context The context of this evaluation.
 * @param base Only <code>null</code> is handled by this resolver.
 *     Other values will result in an immediate return.
 * @param property The name of the scoped attribute to set.
 * @param val The value for the scoped attribute.
 * @throws NullPointerException if context is <code>null</code>.
 * @throws ELException if an exception was thrown while performing
 *     the property or variable resolution. The thrown exception
 *     must be included as the cause property of this exception, if
 *     available.
 */
public void  setValue(ELContext context,
                      Object base,
                      Object property,
                      Object val) {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property instanceof String) {
            PageContext ctxt = (PageContext)
                                   context.getContext(JspContext.class);
            String attr = (String) property;
            if (ctxt.getAttribute(attr, PageContext.REQUEST_SCOPE) != null)
                ctxt.setAttribute(attr, val, PageContext.REQUEST_SCOPE);
            else if (ctxt.getAttribute(attr, PageContext.SESSION_SCOPE) != null)
                ctxt.setAttribute(attr, val, PageContext.SESSION_SCOPE);
            else if (ctxt.getAttribute(attr, PageContext.APPLICATION_SCOPE) != null)
                ctxt.setAttribute(attr, val, PageContext.APPLICATION_SCOPE);
            else {
                ctxt.setAttribute(attr, val, PageContext.PAGE_SCOPE);
            }
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:55,代碼來源:ScopedAttributeELResolver.java


注:本文中的javax.el.ELContext.getContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。