What is MVC Architecture?
Answer Posted / manish
MVC Architecture
It is just an application
interface. It has three parts.
1. Model
2. View
3. Controller
MVC was originally developed to map the traditional input,
processing, output roles into the GUI realm:
Input –> Processing –> Output
Controller –> Model –> View
The main aim of MVC architecture is to separate the
business logic and application data from the presentation
data to the user.
Architecture:
Model:
• A model is an object that manages information.
• It calculates, sorts, stores, retrieves, simulates,
emulates, converts, and does just about anything else you
can think of doing to information.
• The model by itself has no visual representation.
• It includes the validation rules.
• It does not know how to display the information it
contains.
• As MVC architecture the model information can be
divided into two categories:
i) Domain information Model
ii) Application information Model
I) Domain information Model:
• Domain information model includes that information
concerned with the problem domain.
• For example, if we have an airline reservation
application, then flight schedules, prices, seating
arrangements, and credit card numbers would all be domain
information.
II) Application information Model:
• Application information model is any information
that is used by the application but is not part of the
problem domain.
• In the airline reservation example, error messages
are part of the application information.
View:
• The view provides a visual representation of the
information contained in the model.
• As the information in the model changes, the view
should automatically change.
• A view depends on the information contained within
its model.
• Examples of views are input fields, text editors,
and even entire windows.
Controller:
• Whenever the user sends a request for something
then it always go through the controller.
• The Controller is responsible for intercepting the
requests from view and passes it to the model for the
appropriate action.
• After the action has been taken on the data, the
controller is responsible for directing the appropriate
view to the user.
View to model communication
The views know of the model and will interact
with the model.
• If a button is clicked an action
message might be sent to a model object in
order to get something done.
• If a new value is typed into an
entry field an update message might be sent to a model
object in order to give it its new value.
• If a value is needed for a display
an enquiry message might be sent to a model object in order
to get a value.
Model (and controller) to view communication
• Whenever some aspect of the model changes; an
aspect that is displayed in a view.
• Model and controller to communicate with view via
events.
• Using graphical components a list box, an entry
field or a radio button these view components will receive
event notifications such as needs contents, or clicked.
• The events will often come from the controller.
• Views register handlers for the events they wish to
handle.
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is http forward?
What is controller in struts2?
What does params interceptor?
How many Action classes have been used in your project? Differences between struts 1.1 and 1.3?
In struts, how can we access java beans and their properties?
How we can install struts?
What do you mean by the abstract package in struts2, and what is its utilization?
What is the difference in using Action interface and ActionSupport class for our action classes, which one you would prefer?
Are interceptors thread safe?
What is the difference between empty default namespace and root namespace?
What are the struts2 error message keys that can come during file uploading process?
Why actionservlet is singleton in struts?
What is the life cycle of actionform?
What design patterns are used in struts?
How you will make available any message resources definitions file to the struts framework environment?