You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Kaye <ma...@mkaye.co.uk> on 2002/08/30 18:33:20 UTC

[Newbie] Another silly question

Can I use ActionErrors in my actions?  Rather than in my ActionForms?  I
have tried but it causes an error.  I want to be able to do some server
side validation beyond what I do in the ActionForm.  It would make sense
to have this in the action - I think.  Or am I wrong?  Basically I am
authenticating a user and currently the ActionForm does validation on
the userid and password but only that.  Should I also be validating the
user in the database here (I have a business object that does the actual
user validation and use a value bean to pass info between)?  Or should I
do that in the Action itself?

Suggestions appreciated.

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


Re: [Newbie] Another silly question

Posted by Eddie Bush <ek...@swbell.net>.
The action form should only be enforcing semantic constraints:
    * The data is well-formed
    * The data is a number/whatever
    *  Is the format of the data congruent with what I expect (ie 
mm/dd/yyyy for a date, etc)

The action should be responsible for actually calling business logic:
    *  Is this a real user?
    *  Is their account still valid?

Mark Kaye wrote:

>Can I use ActionErrors in my actions?  Rather than in my ActionForms?  I
>have tried but it causes an error.  I want to be able to do some server
>side validation beyond what I do in the ActionForm.  It would make sense
>to have this in the action - I think.  Or am I wrong?  Basically I am
>authenticating a user and currently the ActionForm does validation on
>the userid and password but only that.  Should I also be validating the
>user in the database here (I have a business object that does the actual
>user validation and use a value bean to pass info between)?  Or should I
>do that in the Action itself?
>
>Suggestions appreciated.
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org
>



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