net.sf.springlayout.web.layout.taglib
Class LayoutBindTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.springframework.web.servlet.tags.RequestContextAwareTag
          extended by org.springframework.web.servlet.tags.HtmlEscapingAwareTag
              extended by net.sf.springlayout.web.layout.taglib.LayoutBindTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
Direct Known Subclasses:
AbstractFieldTag

public class LayoutBindTag
extends org.springframework.web.servlet.tags.HtmlEscapingAwareTag

Bind tag, supporting evaluation of binding errors for a certain bean or bean property. Exports a "status" variable of type BindStatus, both to Java expressions and JSP EL expressions.

Can be used to bind to any bean or bean property in the model. The specified path determines whether the tag exposes the status of the bean itself (showing object-level errors), a specific bean property (showing field errors), or a matching set of bean properties (showing all corresponding field errors).

The Errors object that has been bound using this tag is exposed, as well as the bean property that this errors object applies to. Nested tags like the transform tag can access those exposed properties.

Author:
Rod Johnson, Juergen Hoeller, Rob Monie
See Also:
setPath(java.lang.String), getErrors(), getProperty(), TransformTag, Serialized Form

Field Summary
protected  boolean ignoreNestedPath
           
protected  java.lang.String path
          Name of the exposed variable within the scope of this tag: "status".
protected  java.lang.String pathIfNestedNull
          Added as a way of returning the resolved path in the case of a nested null value in the object graph (AB).
protected  java.lang.Object previousStatus
           
protected  org.springframework.web.servlet.support.BindStatus status
           
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
 
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
LayoutBindTag()
           
 
Method Summary
 int doEndTag()
           
 void doFinally()
           
protected  int doStartTagInternal()
           
 java.beans.PropertyEditor getEditor()
          Retrieve the PropertyEditor for the property that this tag is currently bound to.
 org.springframework.validation.Errors getErrors()
          Retrieve the Errors instance that this tag is currently bound to.
 java.lang.String getPath()
          Return 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.
 boolean isIgnoreNestedPath()
          Return whether to ignore a nested path, if any.
 void setIgnoreNestedPath(boolean ignoreNestedPath)
          Set whether to ignore a nested path, if any.
 void setPath(java.lang.String path)
          Set the path that this tag should apply.
 
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
isHtmlEscape, setHtmlEscape
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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

path

protected java.lang.String path
Name of the exposed variable within the scope of this tag: "status".


ignoreNestedPath

protected boolean ignoreNestedPath

status

protected org.springframework.web.servlet.support.BindStatus status

previousStatus

protected java.lang.Object previousStatus

pathIfNestedNull

protected java.lang.String pathIfNestedNull
Added as a way of returning the resolved path in the case of a nested null value in the object graph (AB).

Constructor Detail

LayoutBindTag

public LayoutBindTag()
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()
Return the path that this tag applies to.


setIgnoreNestedPath

public void setIgnoreNestedPath(boolean ignoreNestedPath)
Set whether to ignore a nested path, if any. Default is to not ignore.


isIgnoreNestedPath

public boolean isIgnoreNestedPath()
Return whether to ignore a nested path, if any.


doStartTagInternal

protected int doStartTagInternal()
                          throws java.lang.Exception
Specified by:
doStartTagInternal in class org.springframework.web.servlet.tags.RequestContextAwareTag
Throws:
java.lang.Exception

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspTagException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspTagException

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 org.springframework.validation.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 org.springframework.web.servlet.tags.RequestContextAwareTag


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.