Using struts to do form validation, this is a simple architecture question.
Example: Forgot Password feature of website.
1. Need to validate e-mail address exists in database.
2. Send password to e-mail address.
With a struts Form, I can validate the e-mail address in the form object, then send the e-mail in the Action class.
Although this means, I need to either have 2 database calls, one to check if the e-mail address exists in the Form class, then one to retrieve the password in the Action object. Or I can retrieve the whole object in the Form class, validate, then in the Action retrieve it again, and it should be cached since it will be the same Session. Or I can just do the validation and retrieval in the Action class, but I would like to avoid that to abstract validation out of the Action.
I just wanted to know what is done in a situation like this? I'm leaning towards retrieving the whole object twice because that seems like less database work. But, then do I have to cache the retrieval query too? "select o from Member o where o.emailaddress =
'xxx@aaa.com'
Abstraction is great, but creates more problems, any ideas?
Thanks for your help