public class TagUtils extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
debug
Debug flag
|
Constructor and Description |
---|
TagUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
findAttribute(String beanName,
javax.servlet.jsp.PageContext pageContext)
Search attribute in different contexts.
|
static Object |
getAttribute(String beanName,
int scope,
javax.servlet.jsp.PageContext pageContext)
Get object from requested context.
|
static ComponentDefinition |
getComponentDefinition(String name,
javax.servlet.jsp.PageContext pageContext)
Get component definition by its name.
|
static Object |
getRealValueFromBean(String beanName,
String beanProperty,
String beanScope,
javax.servlet.jsp.PageContext pageContext)
Locate and return the specified property of the specified bean, from
an optionally specified scope, in the specified page context.
|
static int |
getScope(String scopeName)
Converts the scope name into its corresponding PageContext constant value.
|
static int |
getScope(String scopeName,
int defaultValue)
Get scope value from string value
|
static Object |
retrieveBean(String beanName,
String scopeName,
javax.servlet.jsp.PageContext pageContext)
Retrieve bean from page context, using specified scope.
|
static void |
saveException(javax.servlet.jsp.PageContext pageContext,
Throwable exception)
Save the specified exception as a request attribute for later use.
|
static void |
setAttribute(javax.servlet.jsp.PageContext pageContext,
String name,
Object beanValue)
Store bean in REQUEST_SCOPE context.
|
static void |
setAttribute(javax.servlet.jsp.PageContext pageContext,
String name,
Object value,
String scope)
Store bean in requested context.
|
public static final boolean debug
public static int getScope(String scopeName, int defaultValue) throws javax.servlet.jsp.JspException
scopeName
- Scope as a String.defaultValue
- Returned default value, if not found.int
, or defaultValue
if scope is null
.javax.servlet.jsp.JspException
- Scope name is not recognized as a valid scope.public static int getScope(String scopeName) throws javax.servlet.jsp.JspException
scopeName
- Can be "page", "request", "session", or "application" in any
case.javax.servlet.jsp.JspException
- if the scopeName is not a valid name.public static Object retrieveBean(String beanName, String scopeName, javax.servlet.jsp.PageContext pageContext) throws javax.servlet.jsp.JspException
findAttribute()
.beanName
- Name of bean to retrieve.scopeName
- Scope or null
. If null
, bean is searched using
findAttribute().pageContext
- Current pageContext.null
if not found.javax.servlet.jsp.JspException
- Scope name is not recognized as a valid scope.public static Object findAttribute(String beanName, javax.servlet.jsp.PageContext pageContext)
beanName
- Name of bean to retrieve.pageContext
- Current pageContext.null
if not found.public static Object getAttribute(String beanName, int scope, javax.servlet.jsp.PageContext pageContext)
null
if not found.
Context can be "component" or normal JSP contexts.beanName
- Name of bean to retrieve.scope
- Scope from which bean must be retrieved.pageContext
- Current pageContext.null
if not found.public static Object getRealValueFromBean(String beanName, String beanProperty, String beanScope, javax.servlet.jsp.PageContext pageContext) throws javax.servlet.jsp.JspException
pageContext
- Page context to be searched.beanName
- Name of the bean to be retrieved.beanProperty
- Name of the property to be retrieved, or
null
to retrieve the bean itself.beanScope
- Scope to be searched (page, request, session, application)
or null
to use findAttribute()
instead.javax.servlet.jsp.JspException
- Scope name is not recognized as a valid scopejavax.servlet.jsp.JspException
- if the specified bean is not foundjavax.servlet.jsp.JspException
- if accessing this property causes an
IllegalAccessException, IllegalArgumentException,
InvocationTargetException, or NoSuchMethodExceptionpublic static void setAttribute(javax.servlet.jsp.PageContext pageContext, String name, Object value, String scope) throws javax.servlet.jsp.JspException
null
, save it in REQUEST_SCOPE context.pageContext
- Current pageContext.name
- Name of the bean.scope
- Scope under which bean is saved (page, request, session, application)
or null
to store in request()
instead.value
- Bean value to store.javax.servlet.jsp.JspException
- Scope name is not recognized as a valid scopepublic static void setAttribute(javax.servlet.jsp.PageContext pageContext, String name, Object beanValue) throws javax.servlet.jsp.JspException
pageContext
- Current pageContext.name
- Name of the bean.beanValue
- Bean value to store.javax.servlet.jsp.JspException
- Scope name is not recognized as a valid scopepublic static void saveException(javax.servlet.jsp.PageContext pageContext, Throwable exception)
pageContext
- The PageContext for the current page.exception
- The exception to be saved.public static ComponentDefinition getComponentDefinition(String name, javax.servlet.jsp.PageContext pageContext) throws javax.servlet.jsp.JspException
name
- Definition name.pageContext
- The PageContext for the current page.javax.servlet.jsp.JspException
- -Copyright © 2000–2016 Apache Software Foundation. All rights reserved.