----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: LovedJohnySmith Message 3 in Discussion To apply the MVC architecture to your web applications separate the following: 1. Model = contains business rules and program state, 2. View = outputs HTML documents(including all HTML forms), 3. Controller = ASP page or pages that interpret user's actions. The Controller accepts the user's input, queries the Model as required, updates the Model if necessary, determines which View should be returned to the user, and finally passes control to the appropriate View. The View then ships output back to the user as an HTML document. The Controller does not usually render output itself. Implementation of MVC in ASP ============================= All incoming requests go to a Controller program (one or more ASP pages). That page examines the incoming data, examines and alters the Model as necessary, and passes control (via redirect, transfer, or execute) to View programs/pages which then return output to the user. 1. The "M(odel)" is the model of the process (what you're trying to achieve, e.g., order-entry). The model is described by it's state(i.e., in an order-processing system, the state of an order). So in ASP the MVC "Model" is implemented as Session variables, Application variables, hidden <FORM> variables, cookies, database storage, stateful components, etc. As processing proceeds, only code in the Controller *modifies* the Model, although either the View or Controller may inquire about the Model. 2. The "View" contains only presentation logic - the View exists only to output data (it may also output HTML forms to be completed by the user). All URLs (GET) or form requests (GET or POST) embedded on output HTML pages point to the Controller page(s), above. The View doesn't change the Model. Instead the View only displays information about the Model. 3. The "Controller" contains most of the program logic. Good news is that a developer can look at the Controller (this can be a single ASP page or it could be a number of them) and in a fairly short time, see what's happening in a complex system. So logic isn't distributed over ASP pages as much as in non-MVC implementations. This is one of the most significant advantages of MVC. 4. Business logic that isn't in the database (which IMO is where it *really* belongs) can be put into the Controller also. I hope you can get clear idea about MVC. Thanks, Smith http://spaces.msn.com/members/johnysmith ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
