model view controller - Where does input validation belong in an MVC application? -
i have mvc application receives input form.
login form validation necessary check whether input non-empty.
right before pass model validate in controller.
best practice or not? belong model?
i don't think there's official best practice limiting validation single part of mvc pattern. example, view can (and should) up-front validation using javascript. controller should offer same types of validation, more business-logic related validation. model can offer forms of validation, i.e., setters not allowing null values.
there's interesting discussion of at joelonsoftware.
Comments
Post a Comment