Why MVC ?
- Business Logic (Model) is separate from controller.
Example: In Hotel the owner want to serve multiple cuisine , so need not to learn it own , it hire some body who is specialized in Some specific cuisine like Chinese Cuisine. That Chinese Cuisine is a Model , and owner is just make a call to the Chinese Cuisine Specialized it make the food and handed over to the Owner (Controller).- View is separate from Controller
- View is separate from Model
Conclusion : MVC Follows Separation of Concern Principal.
Framework vs Pattern
- Pattern is the way you can architect your application.
- Framework provides foundation (base) classes and libraries.
- Leverage industry best practices.
To Build our Own MVC Framework
If you want to build 1000 of MVC Applications , you require MVC Framework.
Five Core Components:
ActionsThe most basic unit of work that can be associated with a HTTP request coming from a user.Interceptors- They provide a way to supply pre-processing and post-processing around the action.
- They have access to the action being executed, as well as all environmental variables and execution properties.
- Interceptors are conceptually the same as servlet filters, can be layered and ordered.
Value stack / OGNL.The value stack is exactly what it says it is - a stack of objects. OGNL stands for Object Graph Navigational Language, and provides the unified way to access objects within the value stack.Result types- Chain, Dispatcher, Freemarker, HttpHeader, Redirect, Redirect-Action, Stream, Velocity, XSLT.
- If the attribute is not supplied, the default type "dispatcher" is used - this will render a JSP result.
View technologies.- JSP
- Velocity Templates
- Free marker Templates
- XSLT Transformations


