|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.support.BindStatus
public class BindStatus
Simple adapter to expose the bind status of a field or object. Set as a variable both by the JSP bind tag and Velocity/FreeMarker macros.
Obviously, object status representations (i.e. errors at the object level rather than the field level) do not have an expression and a value but only error codes and messages. For simplicity's sake and to be able to use the same tags and macros, the same status class is used for both scenarios.
RequestContext.getBindStatus(java.lang.String)
,
BindTag
,
AbstractTemplateView.setExposeSpringMacroHelpers(boolean)
Constructor Summary | |
---|---|
BindStatus(RequestContext requestContext,
String path,
boolean htmlEscape)
Create a new BindStatus instance, representing a field or object status. |
Method Summary | |
---|---|
PropertyEditor |
findEditor(Class valueClass)
Find a PropertyEditor for the given value class, associated with the property that this bound status is currently bound to. |
Object |
getActualValue()
Return the actual value of the field, i.e. |
String |
getDisplayValue()
Return a suitable display value for the field, i.e. |
PropertyEditor |
getEditor()
Return the PropertyEditor for the property that this bind status is currently bound to. |
String |
getErrorCode()
Return the first error codes for the field or object, if any. |
String[] |
getErrorCodes()
Return the error codes for the field or object, if any. |
String |
getErrorMessage()
Return the first error message for the field or object, if any. |
String[] |
getErrorMessages()
Return the resolved error messages for the field or object, if any. |
String |
getErrorMessagesAsString(String delimiter)
Return an error message string, concatenating all messages separated by the given delimiter. |
Errors |
getErrors()
Return the Errors instance (typically a BindingResult) that this bind status is currently associated with. |
String |
getExpression()
Return a bind expression that can be used in HTML forms as input name for the respective field, or null if not field-specific. |
String |
getPath()
Return the bean and property path for which values and errors will be resolved (e.g. |
Object |
getValue()
Return the current value of the field, i.e. |
Class |
getValueType()
Get the ' Class ' type of the field. |
boolean |
isError()
Return if this status represents a field or object error. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BindStatus(RequestContext requestContext, String path, boolean htmlEscape) throws IllegalStateException
requestContext
- the current RequestContextpath
- the bean and property path for which values and errors
will be resolved (e.g. "customer.address.street")htmlEscape
- whether to HTML-escape error messages and string values
IllegalStateException
- if no corresponding Errors object foundMethod Detail |
---|
public String getPath()
public String getExpression()
null
if not field-specific.
Returns a bind path appropriate for resubmission, e.g. "address.street". Note that the complete bind path as required by the bind tag is "customer.address.street", if bound to a "customer" bean.
public Object getValue()
null
if not field-specific.
This value will be an HTML-escaped String if the original value already was a String.
public Class getValueType()
Class
' type of the field. Favor this instead of
'getValue().getClass()
' since 'getValue()
' may
return 'null
'.
public Object getActualValue()
null
if not available.
public String getDisplayValue()
This value will be an HTML-escaped String if the original value
was non-null: the toString
result of the original value
will get HTML-escaped.
public boolean isError()
public String[] getErrorCodes()
public String getErrorCode()
public String[] getErrorMessages()
public String getErrorMessage()
public String getErrorMessagesAsString(String delimiter)
delimiter
- separator string, e.g. ", " or "public Errors getErrors()
null
if noneBindingResult
public PropertyEditor getEditor()
null
if nonepublic PropertyEditor findEditor(Class valueClass)
valueClass
- the value class that an editor is needed for
null
if nonepublic String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |