• Register
3,700 points
9 2

Top 20 Struts 1.x Interview Questions (Answered) to Crack your Next Interview

1. What is Struts? Why you have used struts in your application or project.

Answer:

Its is based on MVC pattern which is model view Controller pattern.
Struts is MVC design pattern, it uses Front Controller Pattern and for better flow management

2. What are the main classes which are used in struts application?

Answer:

Main classes in Struts Framework are:
Action servlet: Front controller class responsible for handling the entire request.
Action class: In Action classes we have the business logic ,call to model(DB) is also done through your action class.
Action Form: it’s a java bean which represents our forms and associated with action mapping. And it also maintains the session state its object is automatically populated on the server side with data entered from a form on the client side.
Action Mapping: using this class we do the mapping between object and Action.
ActionForward: this class in Struts is used to forward the result from controller to destination.

3. What are the features of Struts?

Answer:

  • Configuration MVC components

  • POJO based action

  • AJAX Support

  • Various Tag Support

  • Various Result Types

  • Integration Support

4. What are the life cycle methods of interceptor?

Answer:

  • public void init()

  • public void intercept(ActionInvocation ai)

  • public void destroy()

5. What is ValueStack?

Answer:

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

6. What is ActionContext?

Answer:

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

7. What is ActionInvocation?

Answer:

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

8. What is OGNL?

Answer:

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

9. What are the 5 constants of Action interface?

Answer:

  1. SUCCESS

  2. ERROR

  3. INPUT

  4. LOGIN

  5. NONE

10. What does params interceptor?

Answer:

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

11. What does execAndWait interceptor?

Answer:

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

12. What does modelDriven interceptor?

Answer:

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

13. What does validation interceptor?

Answer:

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

14. What are the bundled validators?

Answer:

  • requiredstring

  • stringlength

  • email

  • date

  • int

  • double

  • url

  • regex

 

15. What is the difference between plain-validator and field-validator?

Answer:

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

16. What is the use of jsonValidation?

Answer:

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

17. What are the aware interfaces in struts2?

Answer:

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

20. What is Action Context Hyper?

Answer:

ActionContextHyper is a container in which action is executed. It is unique per thread. 

 

SOURCES :

onlineinterviewquestions.com
fullstack.cafe
indeed.com
upgrad.com

 

3,700 points
9 2