Struts Interview Questions

Struts Interview Questions

1 Explain the tern? Action Servlet?

Ans: In struts technology this class plays the role of controller.controller is responsible for handling all the requests.

2 Define the class? Action?

Ans: Action is part of the controller. The use? of this class is to translate the
HTTP Servlet Request to the business logic.

3 Explain the? struts Valida tor Frame work?

Ans: Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser.

4 Explain the concept? Action Form?

Ans: ActionForm will maintains the session state for web application and the its? object is automatically populated on the server side with data entered from a form on the client side.

5 Whether Is struts thread safe?

Ans: It is not only thread-safe but thread-dependant.

6 Tell me? the various Struts tag libraries?

Ans: Struts provide many tag libraries to ease the development of web applications.

The tag libraries are:

Bean tag library , HTML tag library , Logic tag , Tiles or Template tag library , Nested tag library.

7 In what way Struts relates to J2EE?

Ans: Struts framework is built on J2EE technologies (JSP, Servlet, Taglibs), but it is itself not part of the J2EE standard.

8 Is it possible to? setup Apache Struts to use multiple configuration files?

Ans: Yes Struts can use multiple configuration files.

9 Explain? is Struts actions?

Ans: A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward.

10 Explain about the serialization?

Ans: It is? the mechanism used by RMI to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation.

11 Tell me the XML files used in Validator Framework?

Ans: validator-rules.xml and validation.xml.

12 How can we display error in jsp page?

Ans: <html:errors/>

13 Can struts be called a AOP?

Ans: No.

14 How can we? handle exceptions in Struts?

Ans: By Declarative Exception Handling one can either define global exception handling tags in your struts-config.xml or define the exception handling tags within <action>..</action> tag. Or by Programmatic Exception Handling.

15 Explain about the Action Errors?

Ans: The? class that encapsulates the error messages being reported by the validate() method of an ActionForm. Validation errors are either global to the entire ActionForm bean they are associated with, or they are specific to a particular bean property (and, therefore, a particular input field on the corresponding form).

16 Tell me the main classes of the Struts Framework?

Ans: The main? classes of Struts Framework are Action Form, Action, Action Mapping,? Action Forward, Action Servlet etc.

17 What is the way to enable front-end validation based on the xml in validation.XML?

Ans: The <html:javascript> tag to allow front-end validation based on the xml in validation.XML.

18 What is the term action mapping?

Ans: Struts provides a number of tag libraries that helps to create view components easily.

These tag libraries are:
a) Bean Tags: Bean Tags are used to access the beans and their properties.
b) HTML Tags: HTML Tags provides tags for creating the view components like forms, buttons, etc..
c) Logic Tags: Logic Tags provides presentation logics that eliminate the need for script lets.
d) Nested Tags: Nested Tags helps to work with the nested context.