I would avoid putting any business logic in the action 
class. Place this type of logic in the business class as it
most likely is validation that is valid across all application
logic and not for just one use case.

robert

> -----Original Message-----
> From: Janne Mattila [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 07, 2004 8:15 AM
> To: [EMAIL PROTECTED]
> Subject: Proper place for validation
> 
> 
> I am wondering what would be the propert place for some validation code. 
> Let's say I have a registration page where user inputs his/her information 
> for a new user account. There's a field for e-mail address. On one level 
> that information is validated on the ActionForm, for things such as
> 
> - field is not left empty, if it is required
> - field is a valid e-mail address
> 
> That much seems quite clear. But where should I put a check that ensures 
> that same e-mail address is not already used by an existing account?
> 
> On the other hand, I could put it in the registration action, because 
> checking that is (kind of) user-input validation, and action is a natural 
> place to do this.
> 
> On the other hand, I could put it in my business class. The pros for this 
> would be smaller and simpler action code, and reuse if same check is needed 
> with different actions.
> 
> Any suggestions? Intuitively, I think I would put that check in the Action, 
> but I am happy to hear any arguments in favor or opposing that.
> 
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to