Interview Questions.

Top 100+ Java Struts Interview Questions And Answers

fluid

Top 100+ Java Struts Interview Questions And Answers

Question 1. What Are The Components Of Struts Framework?

Answer :

Struts framework consists of following additives:
1. Based at the Model-View-Controller (MVC) layout paradigm, incredibly isolating all three tiers:
Model: application country
View: presentation of records (JSP, HTML)
Controller: routing of the application glide
2. A request handler provided by using the utility developer this is used to  mapped to a particular URI.
3. A reaction handler that is used to transfer the manage to another aid in an effort to be liable for completing the reaction.
4. A tag library which enables builders to create the interactive form primarily based packages with server pages.
5. Java Servlets
6. JSP (Java Server Pages)
7. Custom Tags
eight. Message Resources

Question 2. What Is The Advantage Of Having A Pojo Class As An Action?

Answer :

The POJO elegance is light weight and clean to test with frameworks like Junit. Moreover, there is no want to create separate ActionForms as in struts one to maintain the values from the source web web page. It is carried out by using a unmarried POJO elegance in struts 2.

J2EE Interview Questions
Question three. Which File Is Used By Controller To Get Mapping Information For Request Routing?

Answer :

Controller uses a configuration document “struts-config.Xml report to get all mapping information to determine which movement to apply for routing of person’s request.It paintings because the router inside the community and procedure and map the request to the related movement or useful resource.

Question four. What’s The Role Of Action Class In Struts?

Answer :

In Struts, Action Class acts as a controller and performs following key tasks:
1.After receiving consumer request, it approaches the user’s request.
2.Uses suitable version and pulls facts from model (if required).
3.Selects proper view to reveal the response to the person.

J2EE Tutorial
Question five. What Is Struts Validator Framework?

Answer :

Struts Validator Framework enables us to validate the facts of both client facet and server side.
There are  kinds of validation supported in the struts framework:-
  1. Clint aspect validation (Using java script assist and allowing  java script in ur browser).
  2. Server site validation (the use of Validator method or ActionServlet magnificence and).
There is some other way that is defining the guidelines of validation in validation-rule.Xml report.
When some statistics validation is not gift inside the Validator framework, then programmer can generate personal validation common sense, this User Defined Validation good judgment can be bind with Validation Framework.
Validation Framework consist of two XML configuration Files:
1. Validator-Rules.Xml file
2. Validation.Xml record

Core Java Interview Questions
Question 6. What Are The Steps Of Struts Installation?

Answer :

In order to apply Struts framework, we simplest need to add Struts.Jar record in our improvement environment. Once jar record is to be had in the CLASSPATH, we are able to use the framework and increase Strut based totally applications.

Question 7. How Duplicate Form Submission Can Be Controlled In Struts?

Answer :

In Struts, action elegance presents two vital techniques which can be used to keep away from reproduction shape submissions.
SaveToken() method of action magnificence generates a unique token and saves it inside the person’s session.IsTokenValid() technique is used then used to check specialty of tokens.

Core Java Tutorial Hibernate Interview Questions
Question eight. In Struts, How Can We Access Java Beans And Their Properties?

Answer :

Bean Tag Library is a Struts library which can be used for getting access to Java beans.

Question nine. Which Configuration File Is Used For Storing Jsp Configuration Information In Struts?

Answer :

For JSP configuration information, Web.Xml report is used.

JavaServer Faces (JSF) Interview Questions
Question 10. What’s The Difference Between Validation.Xml And Validator-rules.Xml Files In Struts Validation Framework?

Answer :

In Validation.Xml, we define validation rules for any particular Java bean even as in validator-policies.Xml record, general and established validation policies are defined.

Hibernate Tutorial
Question 11. What’s The Use Of Struts.Xml Configuration File?

Answer :

Struts.Xml report is one the key configuration documents of Struts framework which is used to outline mapping among URL and movement. When a consumer’s request is acquired by using the controller, controller makes use of mapping information from this document to pick out appropriate action magnificence.

Log4j Interview Questions
Question 12. What’s The Significance Of Logic Tags In Struts?

Answer :

Use of common sense tags in Struts helps in writing a smooth and efficient code at presentation layer without use of scriptlets. 

J2EE Interview Questions
Question thirteen. What Is Actionmapping?

Answer :

Action mapping consists of all the deployment information for a selected Action bean. This elegance is to decide where the consequences of the Action may be sent as soon as its processing is complete.

JavaServer Faces (JSF) Tutorial
Question 14. What Are The Benefits Of Struts Framework?

Answer :

Struts is based on MVC and subsequently there is a good separation of different layers in Struts which makes Struts applications improvement and customization smooth. Use of different configuration files makes Struts applications effortlessly configurable. Also, Struts is open source and consequently, cost powerful.

Question 15. Why Actionservlet Is Singleton In Struts?

Answer :

In Struts framework, actionServlet acts as a controller and all the requests made by means of customers are controlled through this controller. ActionServlet is based onsingleton layout patter as best one object desires to be created for this controller magnificence. Multiple threads are created later for every user request.

Java Management Extensions (JMX) Interview Questions
Question sixteen. How Properties Of A Form Are Validated In Struts?

Answer :

For validation of populated houses, validate() method of ActionForm class is used earlier than managing the manage of formbean to Action elegance.

Log4j Tutorial
Question 17. What Are Disadvantages Of Struts?

Answer :

Although Struts have massive range of advantages related, it additionally calls for bigger mastering curve and additionally reduces transparency in the improvement technique.
Struts additionally lack proper documentation and for many of its additives, customers are not able to get proper on line sources for assist.

Java XML Interview Questions
Question 18. What’s The Use Of Resourcebundle.Properties File In Struts Validation Framework?

Answer :

resourcebundle.Houses report is used to define specific error messages in key fee pairs for any viable mistakes which can arise in the code.
This technique enables to keep the code easy as developer doesn’t need to embed all error messages interior code.

Core Java Interview Questions
Question 19. How Many Servlet Controllers Are Used In A Struts Application?

Answer :

Struts framework works on the concept of centralized manipulate method and the entire application is controlled by way of a single servlet controller. Hence, we require most effective one servlet controller in a servlet utility.

Java XML Tutorial
Question 20. Which Model Components Are Supported By Struts?

Answer :

Struts support all styles of fashions inclusive of Java beans, EJB, CORBA. However, Struts doesn’t have any in-constructed guide for any particular model and it’s the developer’s desire to choose any version.

IReport Interview Questions
Question 21. Is Struts Thread Safe?

Answer :

Yes Struts are thread safe. In Struts, a brand new servlet object is not required to handle every request; as an alternative a brand new thread of action class object is used for every new request.

Question 22. What Configuration Changes Are Required To Use Resource Files In Struts?

Answer :

Resource documents (.Houses documents) may be utilized in Struts by means of including following configuration entry in struts-config.Xml report:
<message-resources parameter=”com.Login.Struts.ApplicationResources”/>

 

NHibernate Tutorial
Question 23. What Are The Core Classes Of Struts Framework?

Answer :

Following are the middle lessons furnished by means of Struts Framework:
1.Action Class
2.ActionForm Class
3.ActionMapping Class
four.ActionForward Class
five.ActionServlet Class

 

NHibernate Interview Questions
Question 24. When Should Be Opt For Struts Framework?

Answer :

Struts should be used when any or some of the subsequent conditions are proper:
1.A relatively strong employer level utility improvement is required.
2.A reusable, quite configurable application is required.
Three.A loosely coupled, MVC based software is required with clear segregation of various layers.

 

Hibernate Interview Questions
Question 25. What Design Patterns Are Used In Struts?

Answer :

Struts is based on version 2 MVC (Model-View-Controller) structure. Struts controller uses the command design pattern and the movement training use the adapter design sample. The manner() technique of the RequestProcessor makes use of the template method design pattern. Struts additionally enforce the following J2EE design styles.
1.Service to Worker
2.Dispatcher View
three.Composite View (Struts Tiles)
four.Front Controller
five.View Helper
6.Synchronizer Token

 

iBATIS Tutorial
Question 26. What Are The Different Kinds Of Actions In Struts?

Answer :

The special kinds of actions in Struts are:
1.ForwardAction
2.IncludeAction
three.DispatchAction
four.LookupDispatchAction
five.SwitchAction

iBATIS Interview Questions
Question 27. How Exceptions Are Handled In Struts Application?

Answer :

Exceptions are handled in struts by the use of anybody of the subsequent  methods:
Programmatically coping with: In this exception are handled by using the use of try to trap block in program. Using this programmer can outline a way to handle the situation while exception arises.
Declarative handling: In this exception managing is completed through the use of the XML document. Programmer defines the exception coping with good judgment in the XML record. 
There are  ways of defining the exception managing logic inside the XML document:
1.Global Action Specific Exception Handler Definition.
2.Local Action Specific Exception Handler Definition.

JavaServer Faces (JSF) Interview Questions
Question 28. What Is Dispatchaction?

Answer :

1.The DispatchAction enable the programmer to mix together associated characteristic or magnificence.
2.Using Dispatch Action programmer can integrate the user associated movement right into a unmarried UserAction. Like add person, delete person and replace user.
Three.DispatchAction execute the motion primarily based at the parameter fee it receives from the user.

Spring MVC Framework Tutorial
Question 29. What Is Lookupdispatchaction?

Answer :

1.The LookupDispatchAction elegance is a subclass of DispatchAction.
2.The LookupDispatchAction is used to call the actual technique.
Three.For using LookupDispatchAction, first we must generate a subclass with a hard and fast of strategies.
Four.It control the forwarding of the request to the great aid in its subclass.
Five.It does a opposite lookup on the resource bundle to get the key and then receives the method whose name is associated with the key into the Resource Bundle.

Spring MVC Framework Interview Questions
Question 30. What Is Struts.Devmode?

Answer :

The struts.DevMode is used to ensure that framework is jogging in improvement mode or manufacturing mode by way of placing authentic or fake. Struts.DevMode is set to false in production segment to lessen impact of performance. By default it's miles "fake". 
It is used due to the following motives:
Resource Reloading: Resource package deal reload on every request
Modification: struts.Xml may be modified without restarting or redeploying the utility
Error Handling: The blunders happens within the software may be stated, as oppose to manufacturing mode.




CFG