1:59 pm - Thursday March 21, 2019

Struts InterviewQuestions4

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

1.            What is the use of validate and reset method

The validate method is called by the controller servlet after the bean properties have been populated, but before the corresponding action class’s execute method is invoked.

reset(): reset() method is called by Struts Framework with each request that uses the defined ActionForm. The purpose of this method is to reset all of the ActionForm?s data members prior to the new request values being set.

2.            Difference between perform() and execute()

Perform method is the method which was deprecated in the Struts Version 1.1.  In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative exception handling, the method signature changed in perform. Now execute just throws Exception. Action.perform() is now deprecated; however, the Struts v1.1 ActionServlet is smart enough to know whether or not it should call perform or execute in the Action, depending on which one is available.

3.            Difference between html and struts based html tags?

Struts tags bind the property value with the Formbean property defined. HTML tags are static and Struts tags are dynamic.

4.            Difference between ForwardAction and IncludeAction

The difference is that you need to use the IncludeAction only if the action is going to be included by another action or jsp. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.

5.            How container identify struts.

This can be accomplished by adding the following servlet definition to the web.xml file :










Once you told the container about the ActionServlet you need to tell it when it should be executed by adding <servelt-mapping> element in web.xml file :





This mapping tells the web application that whenever a request is received with .do appended to the URL then the servlet named action should service the request.

6.            Super class of Action and ActionForm.

Action is a class and ActionForm is an abstract class.

7.            Can we have a custom name for lib folder.


8.            What are the Advantages of Struts ?

Struts follow MVC framework. So the JSP, Java and Action classes are organized and easily maintainable.

Struts offers many advantages to the application programmer while reducing the development time and making the manageability of the application easier.

Advantages of Struts :


Centralized Configuration :

Rather than hard coding information into java programs,many Struts values are represented in XML or property files.

Struts_config.xml file is the place from where you can get all information?s about your web application. This is organized.

Your Action class , Form bean and JSP page information is in Struts_config.xml so don’t need to search . All info in one place.


Form Beans :

Don’t need to set the form vales to your value object . When you want to capture data from a form ( In the servlet you do request.getParameter()).

In the struts you don’t need to do explicitly request.getParameter(). Struts request processor will do for you. All the input data will be set to form bean.


Bean Tags :

Struts provides a set of custom JSP tags (bean:write,in particular) that let you easily output the properties of JavaBeans components.

Basically,these are concise and powerful variations of the standard jsp:useBean and jsp:getProperty tags.


HTML tags :

Struts provides a set of custom JSP tags to create HTML forms that are associated with JavaBeans components.

Form Field Validation :


Apache Struts has built-in capabilities for checking that form values are in the required format.

If values are missing or in an improper format,the form can be automatically redisplayed with error messages and with the previously entered values maintained.

This validation can be performed on the server (in Java),or both on the server and on the client (in JavaScript).

9.            Describe validate() and reset() methods?

validate() : Used to validate properties after they have been populated; Called before FormBean is handed to Action. Returns a collection of ActionError as ActionErrors. Following is the method signature for the validate() method.


reset(): reset() method is called by Struts Framework with each request that uses the defined ActionForm. The purpose of this method is to reset all of the ActionForm’s data members prior to the new request values being set.


2 3 4


Filed in: Z-A Interview Questions

No comments yet.

Leave a Reply