public abstract class

AbstractDataBoundFormElementTag

extends AbstractFormTag
implements EditorAwareTag
java.lang.Object
   ↳ TagSupport
     ↳ org.springframework.web.servlet.tags.RequestContextAwareTag
       ↳ org.springframework.web.servlet.tags.HtmlEscapingAwareTag
         ↳ org.springframework.web.servlet.tags.form.AbstractFormTag
           ↳ org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Base tag for all data-binding aware JSP form tags.

Provides the common path and id properties. Provides sub-classes with utility methods for accessing the BindStatus of their bound value and also for interacting with the TagWriter.

Summary

Constants
String NESTED_PATH_VARIABLE_NAME Name of the exposed path variable within the scope of this tag: "nestedPath".
[Expand]
Inherited Constants
From class org.springframework.web.servlet.tags.RequestContextAwareTag
Fields
public static final String COMMAND_NAME_VARIABLE_NAME This field is deprecated. as of Spring 2.5, in favor of MODEL_ATTRIBUTE_VARIABLE_NAME
[Expand]
Inherited Fields
From class org.springframework.web.servlet.tags.RequestContextAwareTag
Public Constructors
AbstractDataBoundFormElementTag()
Public Methods
void doFinally()
Disposes of the BindStatus instance.
final PropertyEditor getEditor()
String getId()
Get the value of the 'id' attribute.
void setId(String id)
Set the value of the 'id' attribute.
void setPath(String path)
Set the property path from the form object.
Protected Methods
String autogenerateId()
Autogenerate the 'id' attribute value for this tag.
String convertToDisplayString(Object value)
Get a display String for the given value, converted by a PropertyEditor that the BindStatus may have registered for the value's Class.
BindStatus getBindStatus()
Get the BindStatus for this tag.
final Object getBoundValue()
Get the bound value.
String getName()
Get the value for the HTML 'name' attribute.
String getNestedPath()
Get the value of the nested path that may have been exposed by the NestedPathTag.
final String getPath()
Get the resolved property path for the form object.
PropertyEditor getPropertyEditor()
Get the PropertyEditor, if any, in use for value bound to this tag.
String getPropertyPath()
Build the property path for this tag, including the nested path but not prefixed with the name of the form attribute.
String resolveId()
Determine the 'id' attribute value for this tag, autogenerating one if none specified.
void writeDefaultAttributes(TagWriter tagWriter)
Writes the default set of attributes to the supplied TagWriter.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.tags.form.AbstractFormTag
From class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
From class org.springframework.web.servlet.tags.RequestContextAwareTag
From class java.lang.Object
From interface org.springframework.web.servlet.tags.EditorAwareTag

Constants

protected static final String NESTED_PATH_VARIABLE_NAME

Name of the exposed path variable within the scope of this tag: "nestedPath". Same value as NESTED_PATH_VARIABLE_NAME.

Constant Value: "nestedPath"

Fields

public static final String COMMAND_NAME_VARIABLE_NAME

This field is deprecated.
as of Spring 2.5, in favor of MODEL_ATTRIBUTE_VARIABLE_NAME

The name of the javax.servlet.jsp.PageContext attribute under which the command object name is exposed.

Public Constructors

public AbstractDataBoundFormElementTag ()

Public Methods

public void doFinally ()

Disposes of the BindStatus instance.

public final PropertyEditor getEditor ()

Exposes the PropertyEditor for EditorAwareTag.

Use getPropertyEditor() for internal rendering purposes.

Returns
  • the current PropertyEditor, or null if none
Throws
JspException

public String getId ()

Get the value of the 'id' attribute.

public void setId (String id)

Set the value of the 'id' attribute.

May be a runtime expression; defaults to the value of getName(). Note that the default value may not be valid for certain tags.

public void setPath (String path)

Set the property path from the form object. May be a runtime expression.

Protected Methods

protected String autogenerateId ()

Autogenerate the 'id' attribute value for this tag.

The default implementation simply delegates to getName(), deleting invalid characters (such as "[" or "]").

Throws
JspException

protected String convertToDisplayString (Object value)

Get a display String for the given value, converted by a PropertyEditor that the BindStatus may have registered for the value's Class.

Throws
JspException

protected BindStatus getBindStatus ()

Get the BindStatus for this tag.

Throws
JspException

protected final Object getBoundValue ()

Get the bound value.

Throws
JspException
See Also

protected String getName ()

Get the value for the HTML 'name' attribute.

The default implementation simply delegates to getPropertyPath() to use the property path as the name. For the most part this is desirable as it links with the server-side expectation for data binding. However, some subclasses may wish to change the value of the 'name' attribute without changing the bind path.

Returns
  • the value for the HTML 'name' attribute
Throws
JspException

protected String getNestedPath ()

Get the value of the nested path that may have been exposed by the NestedPathTag.

protected final String getPath ()

Get the resolved property path for the form object.

Throws
JspException

protected PropertyEditor getPropertyEditor ()

Get the PropertyEditor, if any, in use for value bound to this tag.

Throws
JspException

protected String getPropertyPath ()

Build the property path for this tag, including the nested path but not prefixed with the name of the form attribute.

Throws
JspException

protected String resolveId ()

Determine the 'id' attribute value for this tag, autogenerating one if none specified.

Throws
JspException

protected void writeDefaultAttributes (TagWriter tagWriter)

Writes the default set of attributes to the supplied TagWriter. Further abstract sub-classes should override this method to add in any additional default attributes but must remember to call the super method.

Concrete sub-classes should call this method when/if they want to render default attributes.

Parameters
tagWriter the TagWriter to which any attributes are to be written
Throws
JspException