Struts Interview Questions and Answers
1.What is Action Class?
An Action class in the struts application is used to handle the request.
- It acts as interface or communication medium between the HTTP request coming to it and business logic used to develop the application.
- Action class consists of RequestProcessor which act as controller. This controller will choose the best action for each incoming request, generate the instance of that action and execute that action.
- This should be in thread-safe manner, because RequestProcessor uses the same instance for no. of requests at same time.
2.What are the various Struts Tag libraries?
The various Struts tag libraries are:
- HTML Tags: used to create the struts input forms and GUI of web page.
- Bean Tags: used to access bean and their properties.
- Logic Tags: used to perform the logical operation like comparison
- Template Tags: used to changes the layout and view.
- Nested Tags: used to perform the nested functionality
- Tiles Tags: used to manages the tiles of the application
3. What’s the role of Action Class in Struts?
DynaActionForm is a special type of actionForm class (sub-class of ActionForm Class) that’s used for dynamically creating form beans. It uses configuration files for form bean creation.
5. What are the Core classes of Struts Framework?
Following the core classes provided by Struts Framework:
- Action Class
- ActionForm Class
- ActionMapping Class
- ActionForward Class
- ActionServlet Class
6.What’s the difference between validation.xml and validator-rules.xml files in Struts Validation framework?
In Validation.xml, we define validation rules for any specific Java bean while in validator-rules.xml file, standard and generic validation rules are defined.
7.What is MVC?
Model View Controller (MVC) is a design pattern used to perform changes in the application.
- Model: Model is referring to business or database. It stores the state of the application. Model has no knowledge of the View and Controller components.
- View: View is referring to the Page Design Code. It is responsible for the showing the result of the user’s query. View modifies itself when any changes in the model happen.
- Controller: Controller is referring to navigational code. Controller will chose the best action for each incoming request, generate the instance of that action and execute that action.