Action has some convenience methods for saving errors - you can do something
like the following in your Action's execute method:

    if (<insert-condition-here>) {
        ActionMessages errors = new ActionMessages();
        errors.add("myProperty",
                   new ActionMessage("myProperty.error"));
        saveErrors(request, errors);
        return mapping.getInputForward();
    }

This will work with the latest version of Struts - it  may vary depending on
what verison you're using.

Niall

----- Original Message ----- 
From: "Scott Van Wart" <[EMAIL PROTECTED]>
Sent: Friday, February 24, 2006 1:29 AM


> I have a number of scenarios where I need to validate against a set of
> rows in a database table.  For example, when logging in, it's all fine
> and dandy to make sure a username and password is entered in the
> ActionForm.validate method, but should database access go in the
> ActionForm?  If so, how do I return errors/messages back to the calling
> page from within the Action.execute method?
>
> - Scott



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to