Package org.apache.struts2.interceptor
Interface ValidationAware
- All Known Subinterfaces:
- ValidatorContext
- All Known Implementing Classes:
- ActionSupport,- CspReportAction,- DefaultActionSupport,- DefaultCspReportAction,- DelegatingValidatorContext,- ValidationAwareSupport,- VisitorFieldValidator.AppendingValidatorContext
public interface ValidationAware
ValidationAware classes can accept Action (class level) or field level error messages. Action level messages are kept
 in a Collection. Field level error messages are kept in a Map from String field name to a List of field error msgs.
- 
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.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.default 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.
- 
Method Details- 
setActionErrorsSet the Collection of Action-level String error messages.- Parameters:
- errorMessages- Collection of String error messages
 
- 
getActionErrorsCollection<String> getActionErrors()Get 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.- Returns:
- Collection of String error messages
 
- 
setActionMessagesSet the Collection of Action-level String messages (not errors).- Parameters:
- messages- Collection of String messages (not errors).
 
- 
getActionMessagesCollection<String> getActionMessages()Get 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.- Returns:
- Collection of String messages
 
- 
setFieldErrorsSet the field error map of fieldname (String) to Collection of String error messages.- Parameters:
- errorMap- field error map
 
- 
getFieldErrorsGet 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.- Returns:
- Map with errors mapped from fieldname (String) to Collection of String error messages
 
- 
addActionErrorAdd an Action-level error message to this Action.- Parameters:
- anErrorMessage- the error message
 
- 
addActionMessageAdd an Action-level message to this Action.- Parameters:
- aMessage- the message
 
- 
addFieldErrorAdd an error message for a given field.- Parameters:
- fieldName- name of field
- errorMessage- the error message
 
- 
hasActionErrorsboolean hasActionErrors()Check whether there are any Action-level error messages.- Returns:
- true if any Action-level error messages have been registered
 
- 
hasActionMessagesboolean hasActionMessages()Checks whether there are any Action-level messages.- Returns:
- true if any Action-level messages have been registered
 
- 
hasErrorsdefault boolean hasErrors()Checks whether there are any action errors or field errors.- Returns:
- (hasActionErrors() || hasFieldErrors())
 
- 
hasFieldErrorsboolean hasFieldErrors()Check whether there are any field errors associated with this action.- Returns:
- whether there are any field errors
 
 
-