org.springframework.web.servlet.tags.form

Class AbstractDataBoundFormElementTag

    • Constructor Detail

      • AbstractDataBoundFormElementTag

        public AbstractDataBoundFormElementTag()
    • Method Detail

      • setPath

        public void setPath(java.lang.String path)
        Set the property path from the form object. May be a runtime expression.
      • setId

        public void setId(@Nullable
                          java.lang.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.

        Overrides:
        setId in class TagSupport
      • getId

        @Nullable
        public java.lang.String getId()
        Get the value of the 'id' attribute.
        Overrides:
        getId in class TagSupport
      • writeDefaultAttributes

        protected void writeDefaultAttributes(TagWriter tagWriter)
                                       throws JspException
        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
      • autogenerateId

        @Nullable
        protected java.lang.String autogenerateId()
                                                     throws JspException
        Autogenerate the 'id' attribute value for this tag.

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

        Throws:
        JspException
      • getName

        @Nullable
        protected java.lang.String getName()
                                              throws JspException
        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
      • getNestedPath

        @Nullable
        protected java.lang.String getNestedPath()
        Get the value of the nested path that may have been exposed by the NestedPathTag.
      • getPropertyPath

        protected java.lang.String getPropertyPath()
                                            throws JspException
        Build the property path for this tag, including the nested path but not prefixed with the name of the form attribute.
        Throws:
        JspException
        See Also:
        getNestedPath(), getPath()
      • getPropertyEditor

        @Nullable
        protected java.beans.PropertyEditor getPropertyEditor()
                                                                 throws JspException
        Get the PropertyEditor, if any, in use for value bound to this tag.
        Throws:
        JspException
      • convertToDisplayString

        protected java.lang.String convertToDisplayString(@Nullable
                                                          java.lang.Object value)
                                                   throws JspException
        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
      • processFieldValue

        protected final java.lang.String processFieldValue(@Nullable
                                                           java.lang.String name,
                                                           java.lang.String value,
                                                           java.lang.String type)
        Process the given form field through a RequestDataValueProcessor instance if one is configured or otherwise returns the same value.