org.apache.struts.action

Class ActionErrors

Implemented Interfaces:
Serializable

public class ActionErrors
extends ActionMessages
implements Serializable

A class that encapsulates the error messages being reported by the validate() method of an ActionForm. Validation errors are either global to the entire ActionForm bean they are associated with, or they are specific to a particular bean property (and, therefore, a particular input field on the corresponding form).

Each individual error is described by an ActionError object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the resulting message.

IMPLEMENTATION NOTE - It is assumed that these objects are created and manipulated only within the context of a single thread. Therefore, no synchronization is required for access to internal collections.

Version:
$Revision: 1.11 $ $Date: 2003/04/15 00:18:45 $

Authors:
David Geary
Craig R. McClanahan

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.struts.action.ActionMessages

ActionMessages.ActionMessageItem

Field Summary

static String
GLOBAL_ERROR
The "property name" marker to use for global errors, as opposed to those related to a specific property.

Fields inherited from class org.apache.struts.action.ActionMessages

GLOBAL_MESSAGE, iCount, messages

Constructor Summary

ActionErrors()
Create an empty ActionErrors object.
ActionErrors(ActionErrors messages)
Create an ActionErrors object initialized with the given messages.

Method Summary

void
add(String property, ActionError error)
Add an error message to the set of errors for the specified property.

Methods inherited from class org.apache.struts.action.ActionMessages

add, add, clear, empty, get, get, isEmpty, properties, size, size

Field Details

GLOBAL_ERROR

public static final String GLOBAL_ERROR
The "property name" marker to use for global errors, as opposed to those related to a specific property.

Constructor Details

ActionErrors

public ActionErrors()
Create an empty ActionErrors object.


ActionErrors

public ActionErrors(ActionErrors messages)
Create an ActionErrors object initialized with the given messages.

Parameters:
messages - The messages to be initially added to this object. This parameter can be null.

Since:
Struts 1.1

Method Details

add

public void add(String property,
                ActionError error)
Add an error message to the set of errors for the specified property.

Parameters:
property - Property name (or ActionErrors.GLOBAL_ERROR)
error - The error message to be added


Copyright B) 2000-2005 - Apache Software Foundation