ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Struts
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1721)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (146)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
What is MVC Architecture?
 Question Submitted By :: Struts
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
MVC is model view controller architecture .
MVC is divided into 3 parts
1.MVC
2.MVC ->1 this is jsp and java bean commmunication.
3.MVC ->2 this is servlet+jsp+javabean+struts commun.

model is backend database or java bean.
view is output html 0r jsp.
controller is logic that is servlet.
 
Is This Answer Correct ?    206 Yes 64 No
Pkr_reddy
 
Answer
# 2
The main aim of the MVC architecture is to separate the
business logic and application data from the presentation
data to the user.

Here are the reasons why we should use the MVC design pattern.

1. They are resuable : When the problems 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.

1). Model: The model object knows about all the data that
need to be displayed. It is model who is aware about all the
operations that can be applied to transform that object. It
only represents the data of an application. The model
represents enterprise data and the business rules that
govern access to and updates of this data. Model is not
aware about the presentation data and how that data will be
displayed to the browser.

2). View : The view represents the presentation of the
application. The view object refers to the model. It uses
the query methods of the model to obtain the contents and
renders it. The view is not dependent on the application
logic. It remains same if there is any modification in the
business logic. In other words, we can say that it is the
responsibility of the of the view's to maintain the
consistency in its presentation when the model changes.

3). 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. In GUIs, the views and the controllers often work
very closely together.
 
Is This Answer Correct ?    148 Yes 21 No
Biswajit Roy
 
 
 
Answer
# 3
MVC stands for Model(bean,EJB),View(Html,Jsp),Controller
(Servlet).MVC pattern is a collabartion of three components
model,view,controller.MVC pattern is a sequence of action
interactions starting with view,then controller and then to
model based on the data persistence.

MVC is an approach for developing interactive application
ie it results in events through user interactions.Model is
responsible for holding the application state,View is for
displaying the current model and controller handles the
event.
 
Is This Answer Correct ?    156 Yes 32 No
Mdsha_asiya
 
Answer
# 4
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 ?    132 Yes 12 No
Amulbaby
 
Answer
# 5
MVC architecture acts just as an application interface.its
has got 3 parts
1) model
2) view
3) controller

The main aim of MVC architecture is to separate the
business logic and application data from the presentation
data to the user

Advantages

1. They are resuable : When the problems 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
 
Is This Answer Correct ?    48 Yes 6 No
Jac
 
Answer
# 6
Model-View-Controller (MVC)
Model-View-Controller architecture is used for interactive
web-applications. This model minimizes the coupling between
business logic and data presentation to web user. This
model divides the web based application into three layers:
1. Model: Model domain contains the business logics and
functions that manipulate the business data. It provides
updated information to view domain and also gives response
to query. And the controller can access the functionality
which is encapsulated in the model.
2. View: View is responsible for presentation aspect of
application according to the model data and also
responsible to forward query response to the controller.
3. Controller: Controller accepts and intercepts user
requests and controls the business objects to fulfill these
requests. An application has one controller for related
functionality. Controller can also be depends on the type
of clients.
 
Is This Answer Correct ?    35 Yes 17 No
Hrishikesh Nandanwar
 
Answer
# 7
Model: Model domain contains the business logics and
functions that manipulate the business data. It provides
updated information to view domain and also gives response
to query. And the controller can access the functionality
which is encapsulated in the model.
2. View: View is responsible for presentation aspect of
application according to the model data and also
responsible to forward query response to the controller.
3. Controller: Controller accepts and intercepts user
requests and controls the business objects to fulfill these
requests. An application has one controller for related
functionality. Controller can also be depends on the type
of clients.
 
Is This Answer Correct ?    23 Yes 11 No
Hghjgjh
 
Answer
# 8
The main aim of the MVC architecture is to separate the
business logic and application data from the presentation
data to the user.

Here are the reasons why we should use the MVC design
pattern.

They are resuable : When the problems recurs, there is no
need to invent a new solution, we just have to follow the
pattern and adapt it as necessary.
They are expressive: By using the MVC design pattern our
application becomes more expressive.
1). Model: The model object knows about all the data that
need to be displayed. It is model who is aware about all
the operations that can be applied to transform that
object. It only represents the data of an application. The
model represents enterprise data and the business rules
that govern access to and updates of this data. Model is
not aware about the presentation data and how that data
will be displayed to the browser.

2). View : The view represents the presentation of the
application. The view object refers to the model. It uses
the query methods of the model to obtain the contents and
renders it. The view is not dependent on the application
logic. It remains same if there is any modification in the
business logic. In other words, we can say that it is the
responsibility of the of the view's to maintain the
consistency in its presentation when the model changes.

3). 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. In GUIs, the views and the controllers
often work very closely together.

Difference between Model 1 and Model 2 architecture:

Features of MVC1:

Html or jsp files are used to code the presentation. To
retrieve the data JavaBean can be used.
In mvc1 archictecture all the view, control elements are
implemented using Servlets or Jsp.
In MVC1 there is tight coupling between page and model as
data access is usually done using Custom tag or through
java bean call.
Features of MVC2:

The MVC2 architecture removes the page centric property of
MVC1 architecture by separating Presentation, control logic
and the application state.
In MVC2 architecture there is only one controller which
receives all the request for the application and is
responsible for taking appropriate action in response to
each request.
 
Is This Answer Correct ?    14 Yes 6 No
Soumen Swarnakar
 
Answer
# 9
Model View Controller architecture (or pattern) allows us
to separate different parts of our applications into tiers
to fulfill this need.

MVC Overview
Model View Controller architecture aims to separate an
application into three parts:

Model: It is the business logic of an application. From an
object oriented perspective it would consist of a set of
classes that implement the critical functionality of an
application from a business point of view.

View: It can consist of every type of interface given to
the user. In ASP.NET the view is the set of web pages
presented by a web application.

Controller: This part of the architecture is the most
difficult to explain, hence the most difficult to implement
in many platforms. The controller is the object that allows
the manipulation of the view. Usually many applications
implement Model-Controller tiers that contain the business
logic along with the necessary code to manipulate a user
interface. In an ASP.NET application the controller is
implicitly represented by the code-behind or the server
side code that generates the HTML presented to the user.

Implementing MVC in ASP.NET
A basic diagram that would help us understand perfectly the
specific parts that implement the Model View Controller
architecture in an ASP.NET application is presented below:
 
Is This Answer Correct ?    8 Yes 4 No
Punit Agrahari
 
Answer
# 10
The basic reason behind the MVC Model is to seperate the
business logic from presentation loic.

In MVC I-> The Jsp is going work just like the Controller
because request and response is get handled by JSP itself
and only model i.e database part is different than view and
controller,means the overall MVC I architecture contains
only two componants.

In MVC II->The model,view and Controller are seperated from
each other,i.e business logic and presentation logic are
seperate and database part are different from each other.
Model->Database,java bean,EJB
View-->JSP,HTML Pages
Controller-->Servlet Controller(Action Servlet)
 
Is This Answer Correct ?    6 Yes 4 No
Sanjay Rathod
 

 
 
 
Other Struts Interview Questions
 
  Question Asked @ Answers
 
What are Struts properties? VI-eTrans 2
what is project architecture?give brief explanation about project architecture? CTS 2
advantages& 5 disadvantages of MVC architecture Satyam 6
How do you customize ActionServlet? Ness-Technologies 3
how can u handle run time exceptions in struts and jsp plz explain briefly not single word answer? TCS 2
What is meant by portals???   9
what is the diff between struts1.0 and struts2.0 Intel 2
what is use of assert keyword in java..?   1
where you will implement the tiles in struts? Wipro 2
How do you know what to give for the "path " under in struts-config.xml ?   1
what is the purpose of action servlet and action?   5
Struts follows which design patterns? IGT 4
 
For more Struts Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com