Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is MVC Architecture?

Answer Posted / amulbaby

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.



Advantages of MVC Architecture:

1. They are reusable:
When the problem recurs, there is no
need to invent a new solution; we just
have to follow the pattern and adapt it as necessary.

2. They are expressive:
By using the MVC design pattern our
application becomes more expressive.

3. Easier support for new types of clients:
To support a new type of client, you simply
write a view and controller for it and wire
them into the existing enterprise model.





Example of MVC architecture:





1. When the user Log In on the login page, a request
is sent to the servlet handler.
2. The servlet handler dispatches the request to the
appropriate control class. In this case,
• Login control.
3. The Control performs the action requested by the
user on the Model; in this case the Login Model.
4. The Model returns a response; in this example, a
successful login message.
5. The Control either redirects to another page or
returns to the same page with new data since the Model has
been updated. In this case, the Control redirects to the
MyPage.
6. The Interpreter gets the HTML for the page
requested by the Control from the appropriate View, in this
case the MyPage View
7. The View returns the HTML for the page.
8. The Interpreter sends the HTML for the page back to
the browser.

Is This Answer Correct ?    133 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are interceptors and servlet filters different?

919


What is struts? Explain

895


Which interceptor is responsible for mapping request parameters to action class Java Bean properties?

1000


What do struts do?

907


How tag libraries are defined in Struts?

948


What is struts framework in java?

891


What is the use of struts config xml file?

803


What do you know about validation plugin ?

906


What is the purpose of @validations annotation?

952


What is action support class in struts2?

941


What is java struts?

881


What do you mean by action errors and what are the results they force?

997


What is the purpose of @customvalidator annotation?

923


Give an example where struts tiles may be used?

959


What are the steps required for setting up validator framework in struts?

954