Struts interview question and anwers[Experienced]/Struts Interview Questions and Answers for Freshers & Experienced

How you will make available any Message Resources Definitions file to the Struts Framework Environment?

>> Message Resources Definitions file are simple .properties files and these files contain the messages that can be used in the struts project.

>> Message Resources Definitions files can be added to the struts-config.xml file through message-resources / > tag.

Posted Date:- 2021-09-14 05:59:20

How you can retrieve the value which is set in the JSP Page in the case of DynaActionForm?

>> DynaActionForm is a popular topic in Struts interview questions. DynaActionForm is a subclass of ActionForm that allows the creation of form beans with dynamic sets of properties, without requiring the developer to create a Java class for each type of form bean.

>> DynaActionForm eliminates the need of FormBean class and now the form bean definition can be written into the struts-config.XML file.

>> So, it makes the FormBean declarative and this helps the programmer to reduce the development time.

Posted Date:- 2021-09-14 05:57:41

What is the best way to handle exceptions in Struts?

Exceptions in Struts can be handled in two ways, as shown below.

Programmatic Exceptions Handling: To handle the exception, we can utilize the Try {} Catch {} block.
Declarative Exception Handling: In struts-config.xml, we can define global exception handling tags or exception handling tags within tags.

Posted Date:- 2021-09-14 05:56:31

In Struts, what configuration file is used to store JSP configuration information?

The Web.xml file is used for JSP configuration details.

Posted Date:- 2021-09-14 05:55:30

How can we get access to Java beans and their properties in Struts?

Bean Tag Library is a Struts library for interacting with Java beans.

Posted Date:- 2021-09-14 05:54:46

What is the purpose of the execAndWait interceptor?

The execAndWait interceptor which is also called as ExecuteAndWait is used to show interim or wait for results.

Posted Date:- 2021-09-14 05:54:16

What is the purpose of the params interceptor?

All parameters on the ValueStack are set by the params interceptor which is also called parameters.

Posted Date:- 2021-09-14 05:53:29

In Struts, what are the different types of Tag Libraries?

To make software development easier, Struts includes a number of tag libraries.

1. Bean Tag Library: This library is used to access Java Beans and their properties.
2. The Nested Tag Library: This allows you to use nested beans in your application.
3. Logic Tag Library: Provides the appropriate output, as well as iteration and flow management.
4. HTML Tag Library: Assists in obtaining the desired HTML output.
5. Tiles Tag Library: Used in tile-based applications.

Posted Date:- 2021-09-14 05:52:48

What are the processes in installing Struts?

All we have to do to use the Struts framework is add the Struts.Jar file to our development environment. We may use the framework and construct Strut-based applications after the jar file is in the CLASSPATH.

Posted Date:- 2021-09-14 05:51:43

What are the Interceptor’s Life Cycle methods?

The Interceptor has three different life cycle approaches, as listed below.

<> init() method
<> destroy() method
<> intercept() method

Posted Date:- 2021-09-14 05:51:03

What do you mean by the abstract package in Struts2, and what is its utilization?

An abstract package usually characterizes inheritable segments, for example, interceptor, different interceptor stacks, result types, etc. But that doesn’t contain any actions. The way we announce a package as abstract is through the package elements attribute as abstract and setting the figure to “true.” By default in case, the abstract attribute is not specified it is false. Struts-default.xml is a major example of an abstract package.

Posted Date:- 2021-09-14 05:49:50

What are the two different types of validations that the Validator Framework supports?

With the purpose of Validation of form information, Validator system is utilized. The two different validations are:

<> Customer Side Validation
<> Server-Side Validation

Posted Date:- 2021-09-14 05:49:12

How can we work with error tags?

Working with error tags isn’t as complex as it looks. Error labels can be put in any place by including <html: errors/> into JSP. Not at all like others, error tags don’t have a body it also does not consist of any characteristics. The main function the error tag performs is to show the error in the place where the mistake tag is put utilizing three highlights – the header, the body and the footer.

Posted Date:- 2021-09-14 05:47:29

What do you mean by action errors and what are the results they force?

Users of a web application may submit wrong information or no data at all. These errors must be gotten as near to the user interface as could be possible, rather than sitting tight for the center level or the database to tell segment can’t be inserted in the database because of expecting a non-null value.
Following are the outcomes of such programming practice:
<> Wastage of server time and assets. Like the request, this wastes time and assets also fail.
<> The negative effect on code quality as the probability of entering invalid information must be checked while utilizing or coding for business logic as they are the hardest codes of the framework and contain enough squares for if-else.

Posted Date:- 2021-09-14 05:46:56

What do you mean by Mode?

The Mode is utilized to ensure that the system is running in development mode or production mode by setting true or false. Mode is set to false production stage to diminish the effect of execution. As a matter, of course, it is “false.” It is utilized due to the accompanying reasons:
>> Asset Reloading: Resource package reload on each request
>> Modification: struts.xml can be modified without restarting or redeploying the application
>> Mistake Handling: The error happens in the application will be accounted for, as opposed to production mode.

Posted Date:- 2021-09-14 05:46:07

What do you mean by inner class and anonymous class?

Inner class: classes that are characterized by different classes.
>> The setting is a relationship performed between two different classes.
>> An inner class can get to private members and information.
>> Inner classes have two advantages:
>> Name control
>> Access control

Anonymous class: This class is a class characterized inside a technique without a name.

>> It is instantiated and pronounced in a similar strategy.
>> It doesn’t have explicit constructors.

Posted Date:- 2021-09-14 05:43:17

At the point, you should go for Struts Framework?

Struts ought to be utilized when any or some of the accompanying conditions are valid:
<> Highly robust venture level application development is needed.
<> A reusable, highly configurable application is needed.
<> Loosely coupled, MVC established application is required with the clear isolation of different layers.

Posted Date:- 2021-09-14 05:42:05

What is the Forward Action utilized for?

When we need to join a current application with struts, we have to utilize the Forward Action. Forward Action is also utilized at whatever point one needs to transfer the entire control starting with one place then onto the next, say, JSP to a nearby server. The Forward Action is also utilized when one needs to acquire the advantages of the usefulness of struts after the integration with Struts. For this situation, Servlets are never written again. Another utilization of forwarding Action is when a request is sent to different assets.

Posted Date:- 2021-09-14 05:40:47

Which library is provided by Struts for form elements like check boxes, text boxes etc?

Struts provide HTML Tags library which can be used for adding form elements like text fields, text boxes, radio buttons etc.

Posted Date:- 2021-09-14 05:39:30

What are the conditions for actionForm to work correctly?

ActionForm must fulfill following conditions to work correctly:

It must have a no argument constructor.
It should have public getter and setter methods for all its properties.

Posted Date:- 2021-09-14 05:38:59

Which technologies can be used at View Layer in Struts?

In Struts, we can use any of the following technologies in view layer:

WML Files
Velocity Templates

Posted Date:- 2021-09-14 05:37:09

Is Struts Framework part of J2EE?

Although Struts framework is based on J2EE technologies like JSP, Java Beans, Servlets etc but it’s not a part of J2EE standards.

Posted Date:- 2021-09-14 05:36:42

What Is Struts.devmode?

The struts.devMode is used to make sure that framework is running in development mode or production mode by setting true or false. struts.devMode is set to false in production phase to reduce impact of performance. By default it is "false".
It is used because of the following reasons:
Resource Reloading: Resource bundle reload on every request
Modification: struts.xml can be modified without restarting or redeploying the application
Error Handling: The error occurs in the application will be reported, as oppose to production mode.

Posted Date:- 2021-09-14 05:36:10

What Is Lookupdispatchaction?

1.The LookupDispatchAction class is a subclass of DispatchAction.
2.The LookupDispatchAction is used to call the actual method.
3.For using LookupDispatchAction, first we should generate a subclass with a set of methods.
4.It control the forwarding of the request to the best resource in its subclass.
5.It does a reverse lookup on the resource bundle to get the key and then gets the method whose name is associated with the key into the Resource Bundle.

Posted Date:- 2021-09-14 05:35:42

What Are The Different Kinds Of Actions In Struts?

The different kinds of actions in Struts are:

Posted Date:- 2021-09-14 05:35:10

When Should Be Opt For Struts Framework?

Struts should be used when any or some of the following conditions are true:
1.A highly robust enterprise level application development is required.
2.A reusable, highly configurable application is required.
3.A loosely coupled, MVC based application is required with clear segregation of different layers.

Posted Date:- 2021-09-14 05:34:42

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

Resource files (.properties files) can be used in Struts by adding following configuration entry in struts-config.xml file:
<message-resources parameter=”com.login.struts.ApplicationResources”/>

Posted Date:- 2021-09-14 05:34:18

Is Struts Thread Safe?

Yes Struts are thread safe. In Struts, a new servlet object is not required to handle each request; rather a new thread of action class object is used for each new request.

Posted Date:- 2021-09-14 05:32:36

Which Model Components Are Supported By Struts?

Struts support all types of models including Java beans, EJB, CORBA. However, Struts doesn’t have any in-built support for any specific model and it’s the developer’s choice to opt for any model.

Posted Date:- 2021-09-14 05:32:08

How Many Servlet Controllers Are Used In A Struts Application?

Struts framework works on the concept of centralized control approach and the whole application is controlled by a single servlet controller. Hence, we require only one servlet controller in a servlet application.

Posted Date:- 2021-09-14 05:31:21

What Are Disadvantages Of Struts?

Although Struts have large number of advantages associated, it also requires bigger learning curve and also reduces transparency in the development process.
Struts also lack proper documentation and for many of its components, users are unable to get proper online resources for help.

Posted Date:- 2021-09-14 05:30:55

Why Actionservlet Is Singleton In Struts?

In Struts framework, actionServlet acts as a controller and all the requests made by users are controlled by this controller. ActionServlet is based onsingleton design patter as only one object needs to be created for this controller class. Multiple threads are created later for each user request.

Posted Date:- 2021-09-14 05:30:23

What Are The Benefits Of Struts Framework?

Struts is based on MVC and hence there is a good separation of different layers in Struts which makes Struts applications development and customization easy. Use of different configuration files makes Struts applications easily configurable. Also, Struts is open source and hence, cost effective.

Posted Date:- 2021-09-14 05:29:58

What’s The Difference Between Validation.xml And Validator-rules.xml Files In Struts Validation Framework?

In Validation.xml, we define validation rules for any specific Java bean while in validator-rules.xml file, standard and generic validation rules are defined.

Posted Date:- 2021-09-14 05:29:27

How do you design pages having long execution time with Struts 2?

All applications have specific requests taking a long execution time. Nothing irritates a user more than having no feedback for a long time. Struts 2 provides an inbuilt interceptor execAndWait to handle this situation. This interceptor helps in providing user an intermediate feedback while the request completes execution.

Posted Date:- 2021-09-14 05:28:18

What is ValueStack?

The ValueStack is a storage area holding all data associated with processing of a request. The ValueStack is per-request. Any value placed on the stack during request processing is accessible later in the processing of same request. Data is placed on the Value Stack by various interceptors and this is available while rendering the view. OGNL is the preferred way of accessing values on the ValueStack.

Posted Date:- 2021-09-14 05:27:36

Lists the bundled validators in Struts?

Struts framework offers a number of built-in validators which are called as bundled validators. These validators are for input validations such as email, phone number, user id.

Struts offer the following bundled validators.

requiredstring validator
stringlength validator
email validator
date validator
int validator
double validator
url validator
regex validator

Posted Date:- 2021-09-14 05:27:08

How can we display validation errors on JSP page?

Validation error arises when a user enters invalid data format into the form. In order to validate this data, Struts enables the developer or programmer with the Validator() method for validating the data from the client side as well as the server side. You can display errors in the JSP page by using this syntax:
SYNTAX: <html:error/>

Posted Date:- 2021-09-14 05:25:23

What do you mean by ActionMapping?

ActionMapping represents the information that is known to RequestProcessor about the mapping of a specific request to a specific Action class. This instance is used to select an Action and then passing on to that Action, thus providing access to configuration information included in the ActionMapping object.

Posted Date:- 2021-09-14 05:24:35

What is validate() and reset() functions?

validate() is like a hook that can be overridden by different subclasses for performing validations on incoming data. This method gets called after a Form Bean gets populated with incoming data. This method includes return type ActionErrors.

Syntax is:

public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)

reset() is a method that gets overridden by subclasses. It is a hook that gets summoned before FormBean gets populated with request data from HTML. Using this method, all form fields get reset.

Syntax is:

public void reset() {}

Posted Date:- 2021-09-14 05:24:11

What configuration files are used in Struts? and struts-config.xml these two files are used to between the Controller and the Model.

Posted Date:- 2021-09-14 05:23:20

How you will make available any Message Resources Definitions file to the Struts Framework Environment?

Message Resources Definitions file are simple .properties files and these files contain the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through < message-resources / > tag. Example: < message-resources parameter= MessageResources / >

Message resource definition files can available to the struts environment in two ways
1. using web.xml as

<message-resource key=”myResorce” parameter=”resource.Application” null=”false”>

Posted Date:- 2021-09-14 05:22:52

What steps are required to for an application migration from Struts1 to Struts2?

Following Steps are required for Struts1 to Struts2 migration:

1. Move Struts1 actionForm to Struts2 POJO.
2. Convert Struts1 configuration file (struts-config.xml) to Struts2 configuration file (struts.xml)

Posted Date:- 2021-09-14 05:21:49

What are the benefits of Struts framework?

Struts is based on MVC and hence there is a good separation of different layers in Struts which makes Struts applications development and customization easy. Use of different configuration files makes Struts applications easily configurable. Also, Struts is open source and hence, cost effective.

Posted Date:- 2021-09-14 05:21:20

When should we use SwtichAction?

The best scenario to use SwitchAction class is when we have a modular application with multiple modules working separately. Using SwitchAction class we can switch from a resource in one module to another resource in some different module of the application.

Posted Date:- 2021-09-14 05:21:06

How can we group related actions in one group in Struts?

To group multiple related actions in one group, we can use DispatcherAction class.

Posted Date:- 2021-09-14 05:20:18

What are the two scope types for formbeans?

1. Request Scope: Formbean values are available in the current request only

2. Session Scope: Formbean values are available for all requests in the current session.

Posted Date:- 2021-09-14 05:20:02

What’s the significance of logic tags in Struts?

Use of logic tags in Struts helps in writing a clean and efficient code at presentation layer without use of scriptlets.

Posted Date:- 2021-09-14 05:19:42

What’s the use of Struts.xml configuration file?

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

Posted Date:- 2021-09-14 05:18:46

What’s the difference between Jakarta Struts and Apache Struts? Which one is better to use?

Both are same and there is no difference between them.

Posted Date:- 2021-09-14 05:18:30

R4R Team
R4R provides Struts Freshers questions and answers (Struts Interview Questions and Answers) .The questions on website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,Struts interview question and anwers[Experienced],Struts Freshers & Experienced Interview Questions and Answers,Struts Objetive choice questions and answers,Struts Multiple choice questions and answers,Struts objective, Struts questions , Struts answers,Struts MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for Struts fresher interview questions ,Struts Experienced interview questions,Struts fresher interview questions and answers ,Struts Experienced interview questions and answers,tricky Struts queries for interview pdf,complex Struts for practice with answers,Struts for practice with answers You can search job and get offer latters by studing .learn in easy ways .