Struts Interview Questions and Answers

Last updated on Feb 02, 2022
  • Share
Struts Interview Questions

Most Frequently Asked Struts Interview Questions

Here in this article, we will be listing frequently asked Struts Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q11. What do you mean by ActionMapping?
Answer

ActionMapping represents the information that is known to RequestProcessor about the mapping of a specific request to a specific Action class. This instance is used to select an Action and then passing on to that Action, thus providing access to configuration information included in the ActionMapping object.

Q12. Explain design patterns which is used in Struts?
Answer

Struts use the model 2 MVC architecture. The controller takes the command design pattern and the action classes have the adapter design pattern. In addition, the process() method of RequestProcessor uses template method design pattern.

This framework also implements the J2EE design patterns:

  • Service to Worker
  • Dispatcher View
  • Composite View (Struts Tiles)
  • Front Controller
  • View Helper
  • Synchronizer Token
Q13. What is the configuration files used in Struts?
Answer

The Struts framework uses one or more configuration files to load and create required application-specific components. These configuration files allow the components to be declaratively specified, rather than having hardcoded behavior and information. This can give you the flexibility to provide your own extensions. Based on XML format, configuration files can be validated against Struts DTD.

 

We can configure with the help of few important configuration files like struts.xml, web.xml,strutsconfig.xml and struts.properties

Q14. What is the difference between validation.xml and validator-rules.xml files in Struts?
Answer
S.no Validator-rules.xml Validation.xml
1. Defines standard validation routines Defines validations that apply to form bean
2. For global specific rules For application specific rules
3. Contain logic for validation Contains types of validation
Q15. How can we display validation errors on JSP page?
Answer

Validation error arises when a user enters invalid data format into the form. In order to validate this data, Struts enables the developer or programmer with the Validator() method for validating the data from the client side as well as the server side. You can display errors in the JSP page by using this syntax:
SYNTAX: <html:error/>

Q16. What do you mean by DynaActionForm?
Answer

In Struts, DynaActionForm is a feature which allows the dynamic creation of ActionForm beans through the XML configuration. In such applications, Form beans are virtual and not hard-coded ActionForm classes.

This reduces the tedious process of managing and creating ActionForm classes.

Q17. What do you mean by tiles in Struts?
Answer

Tiles are used for creating reusable presentation components. When using Tiles, first define a base layout with various sections. Next, define jsp page that should fill the corresponding regions in an external configuration file.

 

There are two ways to specify definition and attributes of Tiles - JSP Tile Definition and XML Tile Definition.

Q18. What do you mean by OGNL?
Answer

OGNL or Object-Graph Navigation Language is an open-source Expression Language that allows the navigation of objects (through syntax) for specifying symmetrically settable values. The syntax provides a high level of abstraction for navigating object graphs. This feature allows for simple array manipulation.

Q19. Explain the difference between Jakarta Struts and Apache Struts?
Answer

Technically, there is no difference between them Apache Struts and Jakarta Struts. They are both similar. Craig McClanahan created Struts and donated it to Apache Foundation. Later, it evolved as a Jakarta project and gained popularity in the J2EE community.

Q20. What are the Core classes of Struts Framework? Explain
Answer

There are 5 core classes in Struts framework:

  • ActionServlet
  • ActionForm
  • Action
  • Action Mapping
  • ActionForward

 

This is one of the most repeatedly asked Java Struts 1.2 interview questions and answers.

Reviewed and verified by Best Interview Question
Best Interview Question

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in...