On Sun, 7 Jul 2002, James Turner wrote:
> Date: Sun, 07 Jul 2002 19:40:59 -0400
> From: James Turner <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Doing business logic validation in the Action
>
> Consider the following: You have a new user creation form, and need to
> ensure that the username chosen doesn't already exist in the database.
>
> To keep any business logic out of the ActionForm, you'd really like to do
> this in the Action. However, as near as I can tell, the Action doesn't
> have any access to the ActionErrors returned from the form, which means
> that you'd have to use another mechanism (like a request attribute) to
> return these type of errors.
>
> Am I missing something, or is this the best practice for business logic
> validation of forms?
>
The struts example app does a "validation check" like this in the Action
instead of in the validate() method, for exactly the reason you describe.
See the source for LogonAction to see how you can create and save error
messages directly in an Action, and return to the right input page as
defined for the current mapping.
> James
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>