Spring Framework

org.springframework.web.util
Class TagUtils

java.lang.Object
  extended by org.springframework.web.util.TagUtils

public abstract class TagUtils
extends java.lang.Object

Utility class for tag library related code, exposing functionality such as translating Strings to web scopes.

Author:
Alef Arendsen, Rob Harrop, Juergen Hoeller, Rick Evans

Field Summary
static java.lang.String SCOPE_APPLICATION
          Constant identifying the application scope
static java.lang.String SCOPE_PAGE
          Constant identifying the page scope
static java.lang.String SCOPE_REQUEST
          Constant identifying the request scope
static java.lang.String SCOPE_SESSION
          Constant identifying the session scope
 
Constructor Summary
TagUtils()
           
 
Method Summary
static void assertHasAncestorOfType(javax.servlet.jsp.tagext.Tag tag, java.lang.Class ancestorTagClass, java.lang.String tagName, java.lang.String ancestorTagName)
          Determine whether the supplied Tag has any ancestor tag of the supplied type, throwing an IllegalStateException if not.
static int getScope(java.lang.String scope)
          Determines the scope for a given input String.
static boolean hasAncestorOfType(javax.servlet.jsp.tagext.Tag tag, java.lang.Class ancestorTagClass)
          Determine whether the supplied Tag has any ancestor tag of the supplied type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_PAGE

public static final java.lang.String SCOPE_PAGE
Constant identifying the page scope

See Also:
Constant Field Values

SCOPE_REQUEST

public static final java.lang.String SCOPE_REQUEST
Constant identifying the request scope

See Also:
Constant Field Values

SCOPE_SESSION

public static final java.lang.String SCOPE_SESSION
Constant identifying the session scope

See Also:
Constant Field Values

SCOPE_APPLICATION

public static final java.lang.String SCOPE_APPLICATION
Constant identifying the application scope

See Also:
Constant Field Values
Constructor Detail

TagUtils

public TagUtils()
Method Detail

getScope

public static int getScope(java.lang.String scope)
Determines the scope for a given input String.

If the String does not match 'request', 'session', 'page' or 'application', the method will return PageContext.PAGE_SCOPE.

Parameters:
scope - the String to inspect
Returns:
the scope found, or PageContext.PAGE_SCOPE if no scope matched
Throws:
java.lang.IllegalArgumentException - if the supplied scope is null

hasAncestorOfType

public static boolean hasAncestorOfType(javax.servlet.jsp.tagext.Tag tag,
                                        java.lang.Class ancestorTagClass)
Determine whether the supplied Tag has any ancestor tag of the supplied type.

Parameters:
tag - the tag whose ancestors are to be checked
ancestorTagClass - the ancestor Class being searched for
Returns:
true if the supplied Tag has any ancestor tag of the supplied type
Throws:
java.lang.IllegalArgumentException - if either of the supplied arguments is null; or if the supplied ancestorTagClass is not type-assignable to the Tag class

assertHasAncestorOfType

public static void assertHasAncestorOfType(javax.servlet.jsp.tagext.Tag tag,
                                           java.lang.Class ancestorTagClass,
                                           java.lang.String tagName,
                                           java.lang.String ancestorTagName)
Determine whether the supplied Tag has any ancestor tag of the supplied type, throwing an IllegalStateException if not.

Parameters:
tag - the tag whose ancestors are to be checked
ancestorTagClass - the ancestor Class being searched for
tagName - the name of the tag; for example 'option'
ancestorTagName - the name of the ancestor tag; for example 'select'
Throws:
java.lang.IllegalStateException - if the supplied tag does not have a tag of the supplied parentTagClass as an ancestor
java.lang.IllegalArgumentException - if any of the supplied arguments is null, or in the case of the String-typed arguments, is composed wholly of whitespace; or if the supplied ancestorTagClass is not type-assignable to the Tag class
See Also:
hasAncestorOfType(javax.servlet.jsp.tagext.Tag, Class)

Spring Framework