Struts Interview Questions and Answers – Basic Struts FAQs


Struts is an open source web application frame work written in java. It is mainly used to develop Java EE web applications. Goal of struts is to separate model(logic) with view(JSP or HTM) and controller. Complex web applications are developed in struts, to become a web application developer learning struts is added qualification even for fresher. Here are few important interview questions.

What is MVC?

MVC stands for model view controller, it is a design pattern put together model (the logic to communicate with data base), view(JSP or Html pages to display message) and controller(controller reacts to the user input. It creates and sets the model). Struts frame provide controller name ActionServlet.

Explain how Struts control data flow?

Struts frame work implements MVC pattern through the use of ActionForward and ActionMapping to keep control –flow decision out of presentation layer. That is in struts-config.xml file.

Which Part of MVC Struts represent?

Mostly Action controller(ActionServlet) is used in MVC. Struts strictly fallow MVC to separate business logic with presentation logic(JSP).

What is the difference between ActionForm and DynaActionForm?

To get the data from user entered text fields we use Form bean concept in Struts. While using form bean, you need to create a java class with few setters and getter and that class need to be extended from ActionForm. While using DynaActionForm you no need to write a java class directly you can get the user details without including setter and getter methods.

Who instantiates Formbean java class?

Request processor`s processActionForm() instantiates Frombean java class.

What scope is applied to Frombean?

Request or session, depending upon what you selected while creating Formbean. Default Frombean scope is session.

What is Connection Pool?

Connection Pool is nothing but set of equal database connection objects.

How to interact with server provided connection pool?

Using DataSource type of object.

Why we need to use Connection Pooling concept if we can use traditional connection management?

Traditional JDBC type of connection is time consuming, reasonis time taken to open a database session and to close the database session included into request processing time. So this approach reduces availability of data base resources. So we use Connection pooling.

How Struts supports validations?

Struts frame work supports both server side and client side validation. Using Validation frame work Struts supports both side validation.

How RequestProcessor decides that validation is success or fail?

Based on ActionErrors instance returned by Formbean java class validate().

If validation fails what Request processor will do?

When RequestProcessor decides that validation is fail then it delegates control to input page.(that you configured in struts-config.xml)

Difference between Bean:write and Bean:message?

Bean:message is to display message from .propertiesfile. Bean:write this tag is used to output bean property value from bean property

In a registration page when user click register button where the control goes to?

When user click on register button then control automatically goes to ActionServlet from there it goes to RequestProcessor.

Which Java class interacts with Database?

In a Struts application Model Class interacts with database.

More interview question will be updated on daily basis, come back to know interview questions about Struts 2 interview questions also.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>