当前位置: 首页>>代码示例>>Java>>正文


Java PageContext.findAttribute方法代码示例

本文整理汇总了Java中javax.servlet.jsp.PageContext.findAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java PageContext.findAttribute方法的具体用法?Java PageContext.findAttribute怎么用?Java PageContext.findAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.jsp.PageContext的用法示例。


在下文中一共展示了PageContext.findAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import javax.servlet.jsp.PageContext; //导入方法依赖的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: getValue

import javax.servlet.jsp.PageContext; //导入方法依赖的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

示例3: getResponseOPML

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 *  Gets the re-ordered/grouped/labeled OPML tree of metadata values from the
 *  cache created by setResponseGroup()
 *
 * @param  context  JSP page context
 * @return          OPML for the group specified with setResponseGroup() and
 *      trimmed to the subset indicated by values passed into setResponse()
 * @see             MetadataVocab#setResponseValue(String,PageContext)
 * @see             MetadataVocab#setResponseList(String[],PageContext)
 * @see             MetadataVocab#setResponseList(ArrayList,PageContext)
 * @see             MetadataVocab#setResponseGroup(PageContext,String,String,String,String,String)
 */
public synchronized String getResponseOPML( PageContext context ) {
	String ret = "";
	MetadataVocabResponseMap responseMap = (MetadataVocabResponseMap)context.findAttribute( "metadataVocabResponseMap" );
	if ( responseMap == null ) {
		ret = "<!-- MUI ERROR: metadataVocabResponseMap is empty -->";
	}
	if ( ( responseMap.metaVersion == null ) || responseMap.metaVersion.equals( "" ) ) {
		ret = getOPML( responseMap.metaFormat, getCurrentVersion( responseMap.metaFormat ),
			responseMap.audience, responseMap.language, responseMap.field, responseMap, false );
	}
	else {
		ret = getOPML( responseMap.metaFormat, responseMap.metaVersion,
			responseMap.audience, responseMap.language, responseMap.field, responseMap, false );
	}
	if ( ret.indexOf( "<outline" ) == -1 ) {
		ret = "";
	}
	return ret;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:32,代码来源:MetadataVocabOPML.java

示例4: setupTag

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 *  Get the vocab object from the page context and expand system to be a
 *  concatenation of system, interface, and language
 *
 * @param  pageContext
 * @exception  JspException
 */
public void setupTag( PageContext pageContext ) throws JspException {
	String contextAttributeName = (String)pageContext.getServletContext().getInitParameter( "metadataVocabInstanceAttributeName" );
	vocab = (MetadataVocab)pageContext.findAttribute( contextAttributeName );
	if ( vocab == null ) {
		System.out.println( "Looked for vocab in " + contextAttributeName );
		throw new JspException( "Vocabulary not found" );
	}
	else {
		try {
			metaVersion = vocab.getCurrentVersion( metaFormat );
		}
		catch ( Exception e ) {
			new JspException( "No current version found for metadata framework " + metaFormat );
		}
		system = metaFormat + "/" + metaVersion + "/" + audience + "/" + language + "/" + field;
		( (MetadataVocabOPML)vocab ).setCurrentTree( system, subGroup );
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:26,代码来源:MetadataVocabTag.java

示例5: lookup

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 * Locate and return the specified bean, from an optionally specified
 * scope, in the specified page context.  If no such bean is found,
 * return <code>null</code> instead.  If an exception is thrown, it will
 * have already been saved via a call to <code>saveException()</code>.
 *
 * @param pageContext Page context to be searched
 * @param name Name of the bean to be retrieved
 * @param scopeName Scope to be searched (page, request, session, application)
 *  or <code>null</code> to use <code>findAttribute()</code> instead
 * @return JavaBean in the specified page context
 * @exception JspException if an invalid scope name
 *  is requested
 */
public Object lookup(PageContext pageContext, String name, String scopeName)
        throws JspException {

    if (scopeName == null) {
        return pageContext.findAttribute(name);
    }

    try {
        return pageContext.getAttribute(name, instance.getScope(scopeName));

    } catch (JspException e) {
        saveException(pageContext, e);
        throw e;
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:TagUtils.java

示例6: findAttribute

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:TagUtils.java

示例7: findAttribute

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 * Find object in one of the contexts.
 * Order : component then pageContext.findAttribute()
 * @param beanName Name of the bean to find.
 * @param pageContext Page context.
 * @return Requested bean or <code>null</code> if not found.
 */
public Object findAttribute(String beanName, PageContext pageContext) {
    Object attribute = getAttribute(beanName);
    if (attribute == null) {
        attribute = pageContext.findAttribute(beanName);
    }
    
    return attribute;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ComponentContext.java

示例8: isEnclosed

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/** Returns a true if the current widget is enclosed inside another widget.
 * @param pageContext The PageContext of the jsp.
 * @return a true if the current widget is enclosed inside another widget.
 */
public static boolean isEnclosed(PageContext pageContext) {
    Boolean result = (Boolean) pageContext.findAttribute(ATTRIBUTE_ENCLOSED);
    if (result != null)
        return result.booleanValue();
    else
        return false;
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:12,代码来源:TagHelper.java

示例9: findMessageResources

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/** This returns the Struts MessageResources.*/
private static MessageResources findMessageResources(PageContext pageContext, String resources) {
    return (MessageResources) pageContext.findAttribute((resources != null ? resources : Globals.MESSAGES_KEY));
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:5,代码来源:MessageHelper.java

示例10: getValue

import javax.servlet.jsp.PageContext; //导入方法依赖的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

示例11: getHtmlFormName

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/** Returns the name attribute used by the HTML form tag
 * @param pageContext The PageContext of the jsp.
 * @return the tag handler for the FormTag.
 */
public static String getHtmlFormName(PageContext pageContext) {
    FormTag f = (FormTag) pageContext.findAttribute(ATTRIBUTE_FORM_TAG);
    return f==null?null:f.getHtmlName();
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:9,代码来源:TagHelper.java

示例12: setResponseValue

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 *  Adds a single metadata value to the re-ordering/grouping/labeling cache
 *
 * @param  value    metadata VALUE encoded ID (i.e. "04") or metadata NAME
 *      (i.e. "DLESE:Intermediate elementary")
 * @param  context  JSP page context
 * @see             MetadataVocab#setResponseGroup(PageContext,String,String,String,String,String)
 * @see             MetadataVocab#setResponseList(String[],PageContext)
 * @see             MetadataVocab#setResponseList(ArrayList,PageContext)
 * @see             MetadataVocab#getResponseOPML(PageContext)
 */
public synchronized void setResponseValue( String value, PageContext context ) {
	MetadataVocabResponseMap responseMap = (MetadataVocabResponseMap)context.findAttribute( "metadataVocabResponseMap" );
	if ( responseMap != null ) {
		responseMap.setValue( value );
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:18,代码来源:MetadataVocabOPML.java

示例13: setResponseList

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 *  Adds an ArrayList of metadata values to the re-ordering/grouping/labeling
 *  cache
 *
 * @param  context  JSP page context
 * @param  values   List of metadata VALUE encoded ID (i.e. "04") or metadata
 *      NAME (i.e. "DLESE:Intermediate elementary")
 * @see             MetadataVocab#setResponseGroup(PageContext,String,String,String,String,String)
 * @see             MetadataVocab#setResponseValue(String,PageContext)
 * @see             MetadataVocab#setResponseList(String[],PageContext)
 * @see             MetadataVocab#getResponseOPML(PageContext)
 */
public synchronized void setResponseList( ArrayList values, PageContext context ) {
	MetadataVocabResponseMap responseMap = (MetadataVocabResponseMap)context.findAttribute( "metadataVocabResponseMap" );
	if ( responseMap != null ) {
		for ( int i = 0; i < values.size(); i++ ) {
			responseMap.setValue( (String)values.get( i ) );
		}
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:21,代码来源:MetadataVocabOPML.java

示例14: getFormTag

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/** Returns the tag handler for the FormTag.
 * @param pageContext The PageContext of the jsp.
 * @return the tag handler for the FormTag.
 */
public static FormTag getFormTag(PageContext pageContext) {
    return (FormTag) pageContext.findAttribute(ATTRIBUTE_FORM_TAG);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:8,代码来源:TagHelper.java

示例15: getFormName

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/** Returns the name of the Form.
 * @param pageContext The PageContext of the jsp.
 * @return the name of the Form in the page context. This is the same as the Struts form name.
 */
public static String getFormName(PageContext pageContext) {
    return (String) pageContext.findAttribute(ATTRIBUTE_FORM_NAME);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:8,代码来源:TagHelper.java


注:本文中的javax.servlet.jsp.PageContext.findAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。