You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Norman Klein <no...@first-franklin.com> on 2002/12/06 20:48:23 UTC

How is property field used in errors.add

We are using just standard validation using a validate method within the
ActionForm

There are a series of validations, which look like the following:

	public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();

		if (getCG_Branch() == null || getCG_Branch().length() < 1) {
			errors.add("CG_Branch", new
ActionError("errors.required", "Contact General: Branch"));
			System.out.println("getCG_Branch failed.
Contact_General_LoanAction will not executed");
		}

        		return errors;
    	}

The "Contact General: Branch" is passed as a parameter to errors:required
(which is specified in the ApplicationsResources.properties file)

	{0} is required

According to the Struts documentation, the "errors.add" call

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

So what functionality does this specified property provide??

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>