org.apache.struts.tiles
Class ComponentContext
java.lang.Object
org.apache.struts.tiles.ComponentContext
- Serializable
public class ComponentContext
extends java.lang.Object
implements Serializable
Component context.
void | addAll(Map newAttributes) - Add all attributes to this context.
|
void | addMissing(Map defaultAttributes) - Add all missing attributes to this context.
|
Object | findAttribute(String beanName, PageContext pageContext) - Find object in one of the contexts.
|
Object | getAttribute(String name) - Get an attribute from context.
|
Object | getAttribute(String beanName, int scope, PageContext pageContext) - Get object from requested context.
|
Iterator | getAttributeNames() - Get names of all attributes.
|
static ComponentContext | getContext(ServletRequest request) - Get component context from request.
|
void | putAttribute(String name, Object value) - Put a new attribute to context.
|
static void | setContext(ComponentContext context, ServletRequest request) - Store component context into request.
|
attributes
private Map attributes
Component attributes.
ComponentContext
public ComponentContext()
Constructor.
ComponentContext
public ComponentContext(Map attributes)
Constructor.
Create a context and set specified attributes.
attributes
- Attributes to initialize context.
addAll
public void addAll(Map newAttributes)
Add all attributes to this context.
Copies all of the mappings from the specified attribute map to this context.
New attribute mappings will replace any mappings that this context had for any of the keys
currently in the specified attribute map.
newAttributes
- Attributes to add.
addMissing
public void addMissing(Map defaultAttributes)
Add all missing attributes to this context.
Copies all of the mappings from the specified attributes map to this context.
New attribute mappings will be added only if they don't already exist in
this context.
defaultAttributes
- Attributes to add.
findAttribute
public Object findAttribute(String beanName,
PageContext pageContext)
Find object in one of the contexts.
Order : component then pageContext.findAttribute()
beanName
- Name of the bean to find.pageContext
- Page context.
- Requested bean or
null
if not found.
getAttribute
public Object getAttribute(String name)
Get an attribute from context.
name
- Name of the attribute.
getAttribute
public Object getAttribute(String beanName,
int scope,
PageContext pageContext)
Get object from requested context.
Context can be 'component'.
beanName
- Name of the bean to find.scope
- Search scope (see PageContext
).pageContext
- Page context.
- requested bean or
null
if not found.
getAttributeNames
public Iterator getAttributeNames()
Get names of all attributes.
getContext
public static ComponentContext getContext(ServletRequest request)
Get component context from request.
request
- ServletRequest.
- ComponentContext or null if context is not found or an
jspException is present in the request.
putAttribute
public void putAttribute(String name,
Object value)
Put a new attribute to context.
name
- Name of the attribute.value
- Value of the attribute.
setContext
public static void setContext(ComponentContext context,
ServletRequest request)
Store component context into request.
context
- ComponentContext to store.request
- Request to store ComponentContext.
Copyright B) 2000-2007 - The Apache Software Foundation