Struts Interview Questions

There is given frequently asked struts interview questions and answers that has been asked in many companies. Let's see the list of top Struts2 interview questions.


1) What is Struts?

Struts is a framework for developing MVC-based framework. Struts2 is the combination of Webwork and struts1 frameworks. More details...


2) What is the difference between struts1 and struts2?

No.Struts1Struts2
1)Action class is not POJO. You need to inherit abstract class.Action class is POJO. You don't need to inherit any class or implement any interface.
2)Front controller is ActionServlet.Front Controller is StrutsPrepareAndExecuteFilter.
3)It uses the concept of RequestProcessor class while processing request.It uses the concept of Interceptors while processing the request.
4)It has only JSP for the view component.It has JSP, Freemarker, Valocity etc. for the view component.
5)Configuration file name can be [anyname].xml and placed inside WEB-INF directory.Configuration file must be struts.xml and placed inside classes directory.
6)Action and Model are separate.Action and Model are combined within action class.

3) What are the features of Struts?

  • Configuration MVC components
  • POJO based action
  • AJAX Support
  • Various Tag Support
  • Various Result Types
  • Integration Support
More details...

4) What is MVC?

MVC is a design pattern. MVC stands for Model, View and Controller. Model represents data, view represents presentation and controller acts as an interface between model and view.

mvc architecture

More details...


5) What is interceptor?

Interceptor is an object i.e. invoked at preprocessing and postprocessing of a request. It is pluggable. More details...


6) What are the life cycle methods of interceptor?

  • public void init()
  • public void intercept(ActionInvocation ai)
  • public void destroy()
More details...

7) What is ValueStack?

ValueStack is a stack that contains application specific object such as action and other model. More details...


8) What is ActionContext?

ActionContext is a container in which action is executed. It is unique per thread. More details...


9) What is ActionInvocation?

ActionInvocation is responsible to invoke action. It holds action and interceptor objects. More details...


10) What is OGNL?

OGNL is an expression language of struts2. It stands for Object Graph Navigation Language. More details...


11) What are the 5 constants of Action interface?

  1. SUCCESS
  2. ERROR
  3. INPUT
  4. LOGIN
  5. NONE
More details...

12) What does params interceptor?

The params (also known as parameters) interceptor sets all parameters on the ValueStack. More details...


13) What does execAndWait interceptor?

The execAndWait (also known as ExecuteAndWait) interceptor is used to display intermediate or wait result. More details...


14) What does modelDriven interceptor?

The modelDriven interceptor makes other model as the default object of ValueStack. By default, action is the default object of ValueStack. More details...


15) What does validation interceptor?

The validation interceptor performs validation checks and adds field-level and action-level error messages. More details...


16) What are the bundled validators?

  • requiredstring
  • stringlength
  • email
  • date
  • int
  • double
  • url
  • regex
More details...

17) What is the difference between plain-validator and field-validator?

In plain-validator one validator can be applied to many fields. In field-validator many validators can be applied to single field. More details...


18) What is the use of jsonValidation?

The jsonValidation interceptor is used to perform asynchronous validation. It works with validation and workflow interceptors. More details...


19) What are the aware interfaces in struts2?

Aware interfaces are used to store information in request, session, application and response objects. The 4 aware interfaces are given below:

  • ServletRequestAware
  • ServletResponseAware
  • SessionAware
  • ServletContextAware
More details...

20) What does i18n interceptor?

The i18n interceptor is used to provide multi lingual support for struts application. More details...

Latest Courses