My question is pertaining to the Struts Form validation
Here is the scenario in Struts:
(1) Once you submit a form, ActionServlet checks for the required Action class and the ActionForm class that is associated with the form submission action.
(2) The input that user provided prior to submitting the form, is checked in the validate method of ActionForm class.
Now my question is, if a validation is to be performed against the database.
Say for example, user inputs an employee id in the form field and I need to check whether the employeeId exists in the database table, I will have to call the database object layer in the ActionForm class.
Doesn’t it violate the MVC pattern in that, you should not call a DAO(database access object) from within the front-end(html, jsp). I am assuming that ActionForm is a part of the presentation rather than a Model and I think you should not call DAO from ActionForm. Am I correct with this assumption?
Thanks in advance!!!
-Bhavin