本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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();
}
示例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 );
}
}
示例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 ) );
}
}
}
示例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);
}
示例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);
}