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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -