org.springframework.web.servlet.tags.form
Class TagIdGenerator

java.lang.Object
  extended by org.springframework.web.servlet.tags.form.TagIdGenerator

abstract class TagIdGenerator
extends java.lang.Object

Utility class for generating 'id' attributes values for JSP tags. Given the name of a tag (the data bound path in most cases) returns a unique ID for that name within the current PageContext. Each request for an ID for a given name will append an ever increasing counter to the name itself. For instance, given the name 'person.name', the first request will give 'person.name1' and the second will give 'person.name2'. This supports the common use case where a set of radio or check buttons are generated for the same data field, with each button being a distinct tag instance.

Since:
2.0
Author:
Rob Harrop, Juergen Hoeller

Field Summary
private static java.lang.String PAGE_CONTEXT_ATTRIBUTE_PREFIX
          The prefix for all PageContext attributes created by this tag.
 
Constructor Summary
TagIdGenerator()
           
 
Method Summary
static java.lang.String nextId(java.lang.String name, PageContext pageContext)
          Get the next unique ID (within the given PageContext) for the supplied name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_CONTEXT_ATTRIBUTE_PREFIX

private static final java.lang.String PAGE_CONTEXT_ATTRIBUTE_PREFIX
The prefix for all PageContext attributes created by this tag.

Constructor Detail

TagIdGenerator

TagIdGenerator()
Method Detail

nextId

public static java.lang.String nextId(java.lang.String name,
                                      PageContext pageContext)
Get the next unique ID (within the given PageContext) for the supplied name.