Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.util
Class TagUtils

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

    public abstract class TagUtils

extends Object

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

- `page` will be transformed to `PageContext.PAGE_SCOPE`
- `request` will be transformed to `PageContext.REQUEST_SCOPE`
- `session` will be transformed to `PageContext.SESSION_SCOPE`
- `application` will be transformed to `PageContext.APPLICATION_SCOPE`

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

Field Summary
`static String` | `SCOPE_APPLICATION` Constant identifying the application scope
`static String` | `SCOPE_PAGE` Constant identifying the page scope
`static String` | `SCOPE_REQUEST` Constant identifying the request scope
`static String` | `SCOPE_SESSION` Constant identifying the session scope

Constructor Summary
`TagUtils()`

Method Summary
`static void` | `assertHasAncestorOfType(Tag tag, Class ancestorTagClass, String tagName, String ancestorTagName)` Determine whether the supplied `Tag` has any ancestor tag of the supplied type, throwing an `IllegalStateException` if not.
`static int` | `getScope(String scope)` Determines the scope for a given input `String`.
`static boolean` | `hasAncestorOfType(Tag tag, 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 String SCOPE_PAGE

  Constant identifying the page scope

  See Also:
    Constant Field Values

### SCOPE_REQUEST

    public static final String SCOPE_REQUEST

  Constant identifying the request scope

  See Also:
    Constant Field Values

### SCOPE_SESSION

    public static final String SCOPE_SESSION

  Constant identifying the session scope

  See Also:
    Constant Field Values

### SCOPE_APPLICATION

    public static final 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(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:
    `IllegalArgumentException` - if the supplied `scope` is `null`

### hasAncestorOfType

    public static boolean hasAncestorOfType(Tag tag,
                                            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:
    `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(Tag tag,
                                               Class ancestorTagClass,
                                               String tagName,
                                               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:
    `IllegalStateException` - if the supplied `tag` does not have a tag of the supplied `parentTagClass` as an ancestor
    `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)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.