There are basically three ways of doing validation with the WW framework when checking user input:

The important thing to note is that validation through PropertyEditors ONLY happens when the form is posted.

For example, if you have something like this:

PasswordEditor.java:
public void setAsText( String txt ) 
    {
        if (txt.length() == 0) 
        {
            throw new IllegalArgumentException( messageBundle.getString( "password_missing" ) );
        }
        setValue( txt );
    }

The length check will only happen on a form POST operation that contains the "password" parameter. If you directly access the action with a GET, the length check will not happen because the password parameter will be missing from the request.

It is probably better to make that check from the doValidation() method of the Action object in this case. The PropertyEditor validation is best used when a value is actually set.

Another issue to consider is when using the "PrepareAction" marker interface. If you set the value directly in the prepare() method of your action object then the PropertyEditor validation will not happen either. You should call BeanUtil.setProperty() within prepare() if you want your validation rules to apply.

public void prepare() 
    {
        webwork.util.BeanUtil.setProperty("password", "test", this);
    }