Struts Interview Questions and Answers

28 September, 2020


Related Blogs


Struts Interview Questions and Answers

1Q) What is ValueStack and OGNL?

Ans: ValueStack is the capacity region where the application information is put away by Struts2 for handling customer demands. The information is put away in ActionContext objects that utilization ThreadLocal to have esteemed particularly to the specific demand string.

Question Graph Navigation Language (OGNL) is an intense Expression Language that is utilized to control information put away on the ValueStack. As should be obvious in the design chart, the two interceptors and result pages can get to information put away on ValueStack utilizing OGNL.

2Q) What is MVC Pattern?

Ans: MVC stands for Model, View, and Controller. It is a software architectural pattern for implementing user interfaces.

Controller: Controls the flow. Sends commands to the model to update the model's state. Sends commands to view to change the view's presentation of the model.

Model: Represents the state of the application. Sometimes - notifies associated views and controllers when there is a change in its state.

View: Visual representation of the model for the user.

Interested in mastering Struts Training? Enroll now for a FREE demo on "Struts Training"


3Q) How to upload file in struts 2?

Ans: To upload file in struts, @InterceptorRef annotation is used in which we can define allowed types and maximum size, etc as below.


@InterceptorRef( params={"allowedTypes","image/jpeg,application/zip", "maximumSize","1000000"}, value="fileUpload" )

4Q) In Struts, How Can We Access Java Beans And Their Properties?

Ans: Bean Tag Library is a Struts library which can be used for accessing Java beans.

5Q) What’s The Use Of Struts.xml Configuration File?

Ans: Struts.xml file is one of the key configuration files of the Struts framework which is used to define a mapping between URL and action. When a user’s request is received by the controller, the controller uses mapping information from this file to select the appropriate action class.

6Q) What Are The Benefits Of Struts Framework?

Ans: Swaggers depend on MVC and subsequently there is a decent division of various layers in Struts which makes Struts applications improvement and customization simple. Utilization of various setup records makes Struts applications effectively configurable. Likewise, Struts is open source and thus, financially savvy.

7Q) What's the part of a handler in MVC based applications?

Ans: It's the activity of handlers to exchange the solicitations to proper models as they are bound to the model layer of MVC engineering. Handlers utilize mapping data from design records for ask for an exchange.

8Q) What is Struts?

Ans: The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, resource bundles, and XML, as well as various Jakarta Commons packages. Struts encourage application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm.

9Q) What is Struts Validator Framework?

Ans: Struts Framework gives the usefulness to approve the shape information. It can be used to approve the information on the client's program and also on the server-side. Struts Framework radiates the java contents and it can be utilized to approve the shape information on the customer program. Server-side approval of shape can be proficient by sub classing your From Bean with DynaValidatorForm class.

Struts Interview Questions for Experienced!

10Q) Can we have multiple struts-config files?

Ans: Yes, we can have multiple struts-config files. We need to add the names of those config files in web.xml.

11Q) What is the controller in Struts?

Ans: Its the servlet in particular ActionServlet.

12Q) What is MVC?

Ans: Model-View-Controller is a design pattern wherein the Model holds the business logic, the controller controls the flow and View takes care of the presentation part of the web application.

13Q) What validate() and reset() method does?

Ans: Validate and reset methods are defined in Form Beans. The validation method is used to validate the request parameters where the reset method to clear Action Form Data members.

14Q) What is the controller in Struts?

Ans: Its the servlet in particular ActionServlet.


About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .