Package org.apache.struts2
Class ValidationAwareSupport
java.lang.Object
org.apache.struts2.ValidationAwareSupport
- All Implemented Interfaces:
- Serializable,- ValidationAware
Provides a default implementation of ValidationAware. Returns new collections for
 errors and messages (defensive copy).
- Version:
- $Date$ $Id$
- Author:
- Jason Carreira, tm_jee
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddActionError(String anErrorMessage) Add an Action-level error message to this Action.voidaddActionMessage(String aMessage) Add an Action-level message to this Action.voidaddFieldError(String fieldName, String errorMessage) Add an error message for a given field.voidClears action errors list.voidClears all error list/maps.voidClears all error and messages list/maps.voidClears field errors map.voidClears messages list.Get the Collection of Action-level error messages for this action.Get the Collection of Action-level messages for this action.Get the field specific errors associated with this action.booleanCheck whether there are any Action-level error messages.booleanChecks whether there are any Action-level messages.booleanChecks whether there are any action errors or field errors.booleanCheck whether there are any field errors associated with this action.voidsetActionErrors(Collection<String> errorMessages) Set the Collection of Action-level String error messages.voidsetActionMessages(Collection<String> messages) Set the Collection of Action-level String messages (not errors).voidsetFieldErrors(Map<String, List<String>> errorMap) Set the field error map of fieldname (String) to Collection of String error messages.
- 
Constructor Details- 
ValidationAwareSupportpublic ValidationAwareSupport()
 
- 
- 
Method Details- 
setActionErrorsDescription copied from interface:ValidationAwareSet the Collection of Action-level String error messages.- Specified by:
- setActionErrorsin interface- ValidationAware
- Parameters:
- errorMessages- Collection of String error messages
 
- 
getActionErrorsDescription copied from interface:ValidationAwareGet the Collection of Action-level error messages for this action. Error messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.- Specified by:
- getActionErrorsin interface- ValidationAware
- Returns:
- Collection of String error messages
 
- 
setActionMessagesDescription copied from interface:ValidationAwareSet the Collection of Action-level String messages (not errors).- Specified by:
- setActionMessagesin interface- ValidationAware
- Parameters:
- messages- Collection of String messages (not errors).
 
- 
getActionMessagesDescription copied from interface:ValidationAwareGet the Collection of Action-level messages for this action. Messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.- Specified by:
- getActionMessagesin interface- ValidationAware
- Returns:
- Collection of String messages
 
- 
setFieldErrorsDescription copied from interface:ValidationAwareSet the field error map of fieldname (String) to Collection of String error messages.- Specified by:
- setFieldErrorsin interface- ValidationAware
- Parameters:
- errorMap- field error map
 
- 
getFieldErrorsDescription copied from interface:ValidationAwareGet the field specific errors associated with this action. Error messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.- Specified by:
- getFieldErrorsin interface- ValidationAware
- Returns:
- Map with errors mapped from fieldname (String) to Collection of String error messages
 
- 
addActionErrorDescription copied from interface:ValidationAwareAdd an Action-level error message to this Action.- Specified by:
- addActionErrorin interface- ValidationAware
- Parameters:
- anErrorMessage- the error message
 
- 
addActionMessageDescription copied from interface:ValidationAwareAdd an Action-level message to this Action.- Specified by:
- addActionMessagein interface- ValidationAware
- Parameters:
- aMessage- the message
 
- 
addFieldErrorDescription copied from interface:ValidationAwareAdd an error message for a given field.- Specified by:
- addFieldErrorin interface- ValidationAware
- Parameters:
- fieldName- name of field
- errorMessage- the error message
 
- 
hasActionErrorspublic boolean hasActionErrors()Description copied from interface:ValidationAwareCheck whether there are any Action-level error messages.- Specified by:
- hasActionErrorsin interface- ValidationAware
- Returns:
- true if any Action-level error messages have been registered
 
- 
hasActionMessagespublic boolean hasActionMessages()Description copied from interface:ValidationAwareChecks whether there are any Action-level messages.- Specified by:
- hasActionMessagesin interface- ValidationAware
- Returns:
- true if any Action-level messages have been registered
 
- 
hasErrorspublic boolean hasErrors()Description copied from interface:ValidationAwareChecks whether there are any action errors or field errors.- Specified by:
- hasErrorsin interface- ValidationAware
- Returns:
- (hasActionErrors() || hasFieldErrors())
 
- 
hasFieldErrorspublic boolean hasFieldErrors()Description copied from interface:ValidationAwareCheck whether there are any field errors associated with this action.- Specified by:
- hasFieldErrorsin interface- ValidationAware
- Returns:
- whether there are any field errors
 
- 
clearFieldErrorspublic void clearFieldErrors()Clears field errors map.Will clear the map that contains field errors. 
- 
clearActionErrorspublic void clearActionErrors()Clears action errors list.Will clear the list that contains action errors. 
- 
clearMessagespublic void clearMessages()Clears messages list.Will clear the list that contains action messages. 
- 
clearErrorspublic void clearErrors()Clears all error list/maps.Will clear the map and list that contain field errors and action errors. 
- 
clearErrorsAndMessagespublic void clearErrorsAndMessages()Clears all error and messages list/maps.Will clear the maps/lists that contain field errors, action errors and action messages. 
 
-