org.springframework.web.servlet.tags
Class BindTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byorg.springframework.web.servlet.tags.RequestContextAwareTag
          extended byorg.springframework.web.servlet.tags.BindTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally

public class BindTag
extends RequestContextAwareTag

Bind tag, supporting evaluation of binding errors for a certain bean or bean property. Exports a "status" variable of type BindStatus

The errors object that has been bound using this tag is exposed, as well as the property that this errors object applies to. Children tags can use the exposed properties

Discussed in Chapter 12 of Expert One-On-One J2EE Design and Development by Rod Johnson.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Serialized Form

Field Summary
static java.lang.String STATUS_VARIABLE_NAME
           
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
BindTag()
           
 
Method Summary
 void doFinally()
           
protected  int doStartTagInternal()
          Called by doStartTag to perform the actual work.
 java.beans.PropertyEditor getEditor()
          Retrieve the PropertyEditor for the property that this tag is currently bound to.
 Errors getErrors()
          Retrieve the Errors instance that this tag is currently bound to.
 java.lang.String getPath()
          Retrieve the path that this tag applies to.
 java.lang.String getProperty()
          Retrieve the property that this tag is currently bound to, or null if bound to an object rather than a specific property.
 void setPath(java.lang.String path)
          Set the path that this tag should apply.
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext, isHtmlEscape, setHtmlEscape
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_VARIABLE_NAME

public static final java.lang.String STATUS_VARIABLE_NAME
See Also:
Constant Field Values
Constructor Detail

BindTag

public BindTag()
Method Detail

setPath

public void setPath(java.lang.String path)
Set the path that this tag should apply. Can be a bean (e.g. "person") to get global errors, or a bean property (e.g. "person.name") to get field errors (also supporting nested fields and "person.na*" mappings). "person.*" will return all errors for the specified bean, both global and field errors.

See Also:
Errors.getGlobalErrors(), Errors.getFieldErrors(java.lang.String)

getPath

public java.lang.String getPath()
Retrieve the path that this tag applies to.

Returns:
the path that this tag applies to, or null if none

doStartTagInternal

protected final int doStartTagInternal()
                                throws java.lang.Exception
Description copied from class: RequestContextAwareTag
Called by doStartTag to perform the actual work.

Specified by:
doStartTagInternal in class RequestContextAwareTag
Returns:
same as TagSupport.doStartTag
Throws:
java.lang.Exception - any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag
See Also:
TagSupport.doStartTag()

getProperty

public final java.lang.String getProperty()
Retrieve the property that this tag is currently bound to, or null if bound to an object rather than a specific property. Intended for cooperating nesting tags.

Returns:
the property that this tag is currently bound to, or null if none

getErrors

public final Errors getErrors()
Retrieve the Errors instance that this tag is currently bound to. Intended for cooperating nesting tags.

Returns:
the current Errors instance, or null if none

getEditor

public final java.beans.PropertyEditor getEditor()
Retrieve the PropertyEditor for the property that this tag is currently bound to. Intended for cooperating nesting tags.

Returns:
the current PropertyEditor, or null if none

doFinally

public void doFinally()
Specified by:
doFinally in interface javax.servlet.jsp.tagext.TryCatchFinally
Overrides:
doFinally in class RequestContextAwareTag


Copyright (C) 2003-2004 The Spring Framework Project.