This is a discussion on mvc: where does validation occur? within the Software Patterns forums, part of the Testing category; hi guys, when implementing mvc with a web application where should validation take place. in the view? the controller? or ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Re: mvc: where does validation occur?
It has to be well-balanced.
Basic validations can be balanced between client-side JScript or server-side messages. (This is where validations can be put into the view) I dont have a case where Controller may need validation apart from checking where the control is being passed. Model can have business validations and through effective use of the exception mechanism built on top Java exception framework. |
|
|||
|
Re: mvc: where does validation occur?
What do u mean by where shuld validation take place??
It should take place where it is required? View should do validation for what it has got is correct.. Model should validate the current value and whether the changed value is acceptable or not. And that requests are properle handled threads are synchronized properly and model is always consistent. controller should ensure that requests should be properly delegated to model. To perform all these whatever validation is required put it in the correct place. |