Tuesday, August 14, 2012

struts interview questions



  • What is MVC? 

Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data.
  Model : The model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.
  View: The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur.
  Controller:The controller reacts to the user input. It creates and sets the model.


  • What is a framework? 

A framework is made up of the set of classes which allow us to use a library in a best possible way for a specific requirement.


  • What is Struts framework? 

Struts framework is an open-source framework for developing the web applications in Java EE, based on MVC-2 architecture.


  • What are the components of Struts?

Struts components can be categorize into Model, View and Controller:

  Model: Components like business logic /business processes and data are the part of model.
  View: HTML, JSP are the view components.
  Controller: Action Servlet of Struts is part of Controller components which works as front controller to handle all the requests.


  • What is ActionServlet?

ActionServlet is a simple servlet which is the backbone of all Struts applications. It is the main Controller component that handles client requests and determines which Action will process each received request


  • What is role of ActionServlet?

ActionServlet performs the role of Controller:
  Process user requests
  Determine what the user is trying to achieve according to the request
  Pull data from the model (if necessary) to be given to the appropriate view,
  Select the proper view to respond to the user
  Delegates most of this grunt work to Action classes
  Is responsible for initialization and clean-up of resources



  • What design patterns are used in Struts?


Struts is based on model 2 MVC (Model-View-Controller) architecture.
Struts controller uses the command design pattern and the action classes use the adapter design pattern.
The process() method of the RequestProcessor uses the template method design pattern.

Struts also implement the following J2EE design patterns.
  Service to Worker
  Dispatcher View
  Composite View (Struts Tiles)
  Front Controller
  View Helper
  Synchronizer Token

http://www.developersbook.com/struts/interview-questions/struts-interview-questions-faqs.php

No comments:

Post a Comment