Struts Interview Questions and Answers

Struts Interview Questions and Answers

Last updated on 21st Oct 2020, Blog, Interview Question

About author

Dhamodharan ((Sr Technical Manager ) )

High level Domain Expert in TOP MNCs with 8+ Years of Experience. Also, Handled Around 20+ Projects and Shared his Knowledge by Writing these Blogs for us.

(5.0) | 16547 Ratings 2344

These Struts Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Struts .

As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer.

1. What is Struts? Why you have used struts in your application or project.


This is the first interview questions anyone asks in Struts to get the interview rolling. Most commonly asked during the less senior level.

Struts are nothing but open source framework mostly used for making web application whenever we use the term framework means it comprises JSP, servlet, custom tags message resources all in one bundle which makes developer task very easy.

It is based on MVC pattern which is model view Controller pattern.

2. What are the main classes which are used in struts application?


This is another beginner’s level Struts interview question which is used to check how familiar candidate is with Struts framework and API. Main classes in Struts Framework are: 

  1. 1. Action servlet: it’s a backbone of web application it’s a controller class responsible for handling the entire request.
  2. 2. Action class: using Action classes all the business logic is developed us call model of the application also.
  3. 3. Action Form: it’s a java bean which represents our forms and associated with action mapping. And it also maintains the session state its object is automatically populated on the server side with data entered from a form on the client side.
  4. 4. Action Mapping: using this class we do the mapping between object and Action.
  5. 5. ActionForward: this class in Struts is used to forward the result from controller to destination.

3. How exceptions are handled in Struts application?


This is little tough Struts interview question though looks quite basic not every candidate knows about it. Below is my answer of this interview questions on Struts:

There are two ways of handling exception in Struts:

  1. 1. Programmatically handling: using try {} catch block in code where an exception can come and flow of code is also decided by programmer .its a normal java language concept.
  2. 2. Declarative handling: There are two ways again either we define <global-Exception> tag inside struts-config.XML file

4. How validation is performed in struts application?


Another classic Struts interview question it’s higher on a level than previous interview questions because it’s related to important validation concept on a web application.

In struts validation is performed using validator framework, Validator Framework in Struts consist of two XML configuration files.

validator-rules.xml file: which contains the default struts pluggable validator definitions. You can add new validation rules by adding an entry in this file. This was the original beauty of struts which makes it highly configurable.

Validation.xml files: which contain details regarding the validation routines that are applied to the different Form Beans. To associate more than one validation rule to the property we can specify a comma-delimited list of values. The first rule in the list will be checked first and then the next rule and so on. Answer of this Struts questions gets bit longer but it’s important to touch these important concepts to make it useful.

5. What is the Difference between DispatchAction and LookupDispatchAction in Struts Framework?


This Struts interview question is pretty straight forward and I have put the differences in tabular format to make it easy to read.

DispatchAction provides a mechanism for grouping a set of related functions into a single action, thus eliminating the need to create separate actions for each function.

An abstract Action that dispatches to the subclass mapped executes method. This is useful in cases where an HTML form has multiple submit buttons with the same name.

The button name is specified by the parameter property of the corresponding ActionMapping.

6. 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.

7. What the Validate () and reset () method does?


This is one of my personal favorite Struts interview questions. validate(): validate method is Used to validate properties after they have been populated, and this , method is  Called before FormBean is passed  to Action.

Returns a collection of ActionError as ActionErrors. Following is the method signature for the validate() method.


  • Public ActionErrors Validate (ActionMapping mapping, HttpServletRequest request)

8. 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. 

Subscribe For Free Demo

Error: Contact form not found.

9. What configuration files are used in Struts?

Ans: and struts-config.xml these two files are used to between the Controller and the Model.

10. Explain Struts work Flow?


Sometime this Struts interview questions asked as first questions but I recall this now J . Here is the answer to this Struts interview questions

Struts flow and architecture

A request comes in from a Java Server Page into the ActionServlet.

The ActionServlet having already read the struts-config.xml file knows which form bean relates to this JSP, and delegates work to the validate method of that form bean.

The form bean performs the validate method to determine if all required fields have been entered, and performs whatever other types of field validations that need to be performed. If any required field has not been entered, or any field does not pass validation, the form bean generates ActionErrors, and after checking all fields returns back to the ActionServlet.

The ActionServlet checks the ActionErrors that were returned from the form beans validate method to determine if any errors have occurred. If errors have occurred, it returns to the originating JSP displaying the appropriate errors.

If no errors occurred in the validate method of the form bean, the ActionServlet passes control to the appropriate Action class. The Action class performs any necessary business logic, and then forwards to the next appropriate action (probably another JSP).

11. What is Struts Framework? What are its Components?


Struts is a type of Web Application Development Framework that provides a suitable platform for developing web applications. Struts include Servlets, JSP, Custom tags and Message resources into a unified framework.

12. Why do we use Struts?


As Struts is based on MVC architecture i.e. Model, View, Controller, it separates Business Logic, Design & Controller, as a result of which it makes the code more simple, maintainable and readable.

13. 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.

14. What are the new features of Struts2?


The prominent features of Struts2 are as follows.

  • Struts2 has JSP, Free marker, and Valocity for the view component.
  • In Struts2, Front Controller is StrutsPrepareAndExecuteFilter.
  • In Struts2, the configuration file name must be struts.xml and should be placed inside the classes directory.
  • Struts2 uses the concept of Interceptors while processing the request.

15. What is MVC?


MVC stands for Model, View, and Controller and is called the Software Design Pattern for developing web applications.

  1. 1. Model: Model is responsible for maintaining the State of Data and Business logic of the application
  2. 2. View: View is responsible to show all data to use i.e. it shows the presentation.
  3. 3. Controller: Controller acts as an interface between View and Model. It intercepts all the requests i.e. receives input and commands to Model/View to change accordingly.

16. What are Interceptors?


Interceptors are the object that provides the pre-processing logic before action is called or provides a post-processing logic after the action is called.

Interceptors can be used to perform various operations such as Validations, Exception Handling, File Uploading, Displaying intermediate results, etc.

17. What are the Life Cycle methods of the Interceptor?


There are three life cycle methods of the Interceptor as mentioned below.

  1. 1. init () method
  2. 2. intercept () method
  3. 3. destroy () method

18. How is a request handled in Struts2 Application?


A request in Struts2 Application is handled in the below manner.

Firstly, the request received is sent to the server by the user. Then the request is handled by FilterDispatcher that selects an appropriate action for it. The defined interceptors perform pre-processing operations like file upload, exception handling, etc.

Now the selected action is executed and the operation is performed. Again the defined interceptors perform post-processing operations like file upload, exception handling, etc.

The final result is displayed to the user in the form of the view page.

19. What is the function of the Struts.xml File in Struts?


In the struts.xml file, the user can define all the mapping to actions so that a particular action is called when a particular operation is performed.

It is also called as the configuration file and is present under the WEB-INF/classes folder.

20. Which Configurations Files are used in Struts?


The configurations files used in Struts include:

  • Struts-config.xml.

21. What are the conditions for actionForm to work correctly?


ActionForm must fulfill following conditions to work correctly:

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

22. What do you mean by Value Stack?


A Value Stack can be explained as a stack that contains requirement specific objects. The action stays at the top of the stack while executing.

The objects are then placed in Value Stack and the user can perform SQL operations on it.

The various methods of Value Stack are as follows:

  1. 1. FindString (): Used to find the string from the given expression.
  2. 2. FindValue (): Used to find value from the given expression.
  3. 3. Peek (): It gives the object located at the top of the stack.
  4. 4. Pop (): It gives the object located at the top of the stack and removes it.
  5. 5. Push (): It pushes the object to the top of the stack.

23. What do you mean by Action Context?


The Action Context is an object container in which actions are executed. The values that are stored in the Action Context are unique per thread (i.e. Thread Local), as a result of which, we don’t need to make our action thread-safe.

By calling the getContext() method of ActionContext class, we can get the reference of ActionContext.

It is a static factory method.

For Example:

  • ActionContext context = ActionContext.getContext();

24. What is the use of ActionInvocation?


The ActionInvocation is used to represent the action’s execution state. It holds the action and the interceptor object.

25. What is the use of OGNL?


Object Graph Navigation Language (OGNL) is a strong expression language. It helps to simplify the accessibility of data stored in the ActionContext. OGNL supports interacting with collections i.e. Map, List, and Set.

The struts framework helps to set the ValueStack as the root object of OGNL. The action object is pushed into the ValueStack and we can directly access the action property.

26. What are the types of constants present in the Action Interface?


There are five types of constants provided by the Action Interface. They are,

  • Login
  • Input
  • Success
  • Error
  • None

27. How can we create Action Classes in Struts2?


There are many ways to create Action Classes in Struts2. Some of them are as follows:

  1. 1. Using Strts2 @Action annotation.
  2. 2. Extend the ActionSupport class.
  3. 3. By implementing the Action Interface.

28. How can we Handle Exceptions in Struts?


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

Programmatic Exception Handling: In this, we can use Try {} Catch {} block to handle the exception.

Declarative Exception Handling: Here, we can define the global exception handling tags in struts-config.xml or define exception handling tags within tags.

29. What are the Types of Tag Libraries in Struts?


Struts provides many tag libraries to ease software development.

  • Bean Tag Library: Used for accessing Java Beans and its properties.
  • Nested Tag Library: Provides the ability to use nested beans in the application.
  • Logic Tag Library: Used for giving the required output, iteration capability and flow management.
  • HTML Tag Library: Helps to get the required HTML output.
  • Tiles Tag library: Used in applications that have tiles.

30. What are the different types of Struts Actions?


Forward Action: With this class, we can control the Struts controller and its functionality, without having to rewrite the existing Servlets.

Include Action: Using IncludeAction class to include another resource in the response to the request being processed.

Switch Action: Used to switch one resource in one module to another resource in another module.

Dispatch Action: Used to combine the related actions into a single class.

LookUpAction: Used to drive the action with a key if the action name is not working.

31. What are the different types of tags in Struts2?:


  1. 1. Control Tag (If Else tag, Iterator Tag, Merge Tag, Append Tag, Generator Tag, etc.)
  2. 2. Data Tag (Action tag, Include Tag, Bean Tag, Date Tag, Param Tag, Property Tag, Push Tag, Set Tag, Text Tag, etc.)
  3. 3. Form Tag (All the simple UI Tags.)
  4. 4. Ajax Tag

32. What do you mean by Internationalization? Why do we need it?


Internationalization (i18n) is the interceptor that is used for planning and implementing products and services so that they can be easily adapted to specific local languages and cultures i.e. a process called localization.

It handles setting locale for the action. It can be used if the user wants to set his/her locale and get data according to the locale provided.

33. What are the Core Components of Struts2?


  1. 1. Interceptors
  2. 2. Value Stack
  3. 3. Action Context
  4. 4. OGNL
  5. 5. ActionInvocation

34. How can we create Custom Interceptor?


We can create the custom interceptor by implementing the Interceptor interface in a class and overriding its three life cycle method i.e. init (), Destroy (), Intercept (). It can also be created by defining the entry of the interceptor in the struts.xml file.

Course Curriculum

Get Enroll in Struts Training with Instructor-led Classes

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments
Explore Curriculum

35. What is the functionality of the Token Interceptor in Struts2?


The major problem with web applications is the double form submission that results in charging double amounts from the user and storing double values in the database.

We can use a token interceptor to solve the double form submission problem. This interceptor is defined in the struts-default package.

36. How to upload files in the Struts2 Application?


With the help of the File Upload Interceptor, we can upload files in the struts2 application.

37. Is Struts2 Action Synchronized?


Yes, Struts2 Actions are synchronized as an object is invoked to handle any new incoming request.

38. Are Struts2 Interceptors Synchronized?


As Struts2 interceptors are singleton classes and as a new thread is created to handle the request, it is not synchronized and we need to implement them carefully to avoid any issues with the shared data.

39. What is the Front Controller in Struts2?


StrutsPrepareAndExecuteFilter is the Front Controller class in Struts2, it is also the starting point of every incoming request.

40. How are ValueStack and OGNL linked?


OGNL is a library through which the ValueStack data or values are manipulated whereas ValueStack is a stack where all values and data related to actions are stored.

41. Write the syntax to display the output page using XML in Struts2?


Here in Struts2, a user can declare the XML file as shown below:

  • <actionname=”output “class=”com.softwaretestinghelp.actionname”>
  • <result name=”SUCCESS”>output.jsp</result>
  • <result name=”ERROR”>error.jsp</result>

42. Which Design Pattern is followed by the Interceptors?


Interceptors follow a design pattern based on the intercepting filters.

43. Where is the Plug-in tag found in Struts2? What is the function of the Plug-in tag?


Plug-in tag is found in the struct-config.xml and is used to tell the user where the properties file that has all the prompt and error message is found.

44. What are the disadvantages of the Struts Framework?


Some of the disadvantages of the Struts Framework are as follows:

  • Only one servlet controller is used.
  • No proper documentation.
  • Transparency is not full.
  • The approach is inflexible.
  • A lot of things are there to learn.

45. What are the components of Struts Framework?


Struts framework is comprised of following components:

  1. 1. Java Servlets
  2. 2. JSP (Java Server Pages)
  3. 3. Custom Tags
  4. 4. Message Resources

46. What’s the role of a handler in MVC based applications?


It’s the job of handlers to transfer the requests to appropriate models as they are bound to the model layer of MVC architecture. Handlers use mapping information from configuration files for request transfer.

47. What’s the flow of requests in Struts based applications?


Struts based applications use MVC design pattern. The flow of requests is as follows:

  1. 1. User interacts with View by clicking any link or by submitting any form.
  2. 2. Upon user’s interaction, the request is passed towards the controller.
  3. 3. Controller is responsible for passing the request to appropriate action.
  4. 4. Action is responsible for calling a function in Model which has all business logic implemented.
  5. 5. Response from the model layer is received back by the action which then passes it towards the view where user is able to see the response.

48. Which file is used by controller to get mapping information for request routing?


Controller uses a configuration file “struts-config.xml file to get all mapping information to decide which action to use for routing of user’s request.

49. What’s the role of Action Class in Struts?


In Struts, Action Class acts as a controller and performs following key tasks:

  • After receiving user request, it processes the user’s request.
  • Uses appropriate model and pulls data from model (if required).
  • Selects proper view to show the response to the user.

50. How an actionForm bean is created?


actionForm bean is created by extending the class org.apache.struts.action.ActionForm

51. What are the two types of validations supported by Validator FrameWork?


This framework provides two types of validations:

  1. 1. Validator Framework is used for form data validation.
  2. 2. Client Side validation on user’s browser

52. What are the steps of Struts Installation?


In order to use Struts framework, we only need to add Struts.Jar file in our development environment. Once jar file is available in the CLASSPATH, we can use the framework and develop Strut based applications.

53. How client side validation is enabled on a JSP form?


In order to enable client side validation in Struts, first we need to enable validator plug-in in struts-config.xml file. This is done by adding following configuration entries in this file.

54. How action-mapping tag is used for request forwarding in Struts configuration file?


In Struts configuration file (struts-config.xml), forwarding options are defined under action-mapping tag.

In the following example, when a user will click on the hyperlink, request will be forwarded to /pages/testing.jsp using following configurations from struts-config.xml file.

55. How duplicate form submission can be controlled in Struts?


In Struts, action class provides two important methods which can be used to avoid duplicate form submissions.

saveToken() method of action class generates a unique token and saves it in the user’s session.

isTokenValid() method is used then used to check uniqueness of tokens.

56. In Struts, how can we access Java beans and their properties?


Bean Tag Library is a Struts library which can be used for accessing Java beans.

57. Which configuration file is used for storing JSP configuration information in Struts?


For JSP configuration details, Web.xml file is used.

58. What’s the purpose of Execute method of action class?


Execute method of action class is responsible for execution of business logic. If any processing is required on the user’s request, it’s performed in this method.

This method returns actionForward object which routes the application to appropriate page.

59. 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.

60. How can we display all validation errors to user on JSP page?


To display all validation errors based on the validation rules defined in validation.xml file, we use <html:errors /> tag in our JSP file.

61. What’s declarative exception handling in Struts?


When logic for exception handling is defined in struts-config.xml or within the action tag, it’s known as declarative exception handling in Struts.

62. What’s DynaActionForm?


DynaActionForm is a special type of actionForm class (sub-class of ActionForm Class) that’s used for dynamically creating form beans. It uses configuration files for form bean creation.

63. What configuration changes are required to use Tiles in Struts?


To create reusable components with Tiles framework, we need to add following plugin definition code in struts-config.xml file:

  • <plug-in className=”org.apache.struts.tiles.TilesPlugin” >
  • <set-property >

64. 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.

65. 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.

66. How tag libraries are defined in Struts?


Tag libraries are defined in the configuration file (web.xml) inside <taglib> tag as follows:

  • <taglib>
  • <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
  • <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  • </taglib>

67. 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.

68. 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.

Java Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

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


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

70. 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.

71. 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.

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


Following Steps are required for Struts1 to Struts2 migration:

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

73. How properties of a form are validated in Struts?


For validation of populated properties, validate() method of ActionForm class is used before handling the control of formbean to Action class.

74. What’s the use of reset method of ActionForm class?


Reset method of action : Form class is used to clear the values of a form before initiation of a new request.

75. 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.

76. What’s the use of file in Struts Validation framework?

Ans: file is used to define specific error messages in key value pairs for any possible errors that may occur in the code. This approach helps to keep the code clean as developer doesn’t need to embed all error messages inside code.

77. Can I have html form property without associated getter and setter formbean methods?


For each html form property, getter and setter methods in the formbean must be defined otherwise application results in an error.

78. 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.

79. For a single Struts application, can we have multiple struts-config.xml files?


We can have any number of Struts-config.xml files for a single application.

We need following configurations for this:

  • <servlet>
  • <servlet-name>action</servlet-name>
  • <servlet-class>
  • org.apache.struts.action.ActionServlet 

80. 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.

81. When it’s useful to use IncludeAction?


IncludeAction is action class provided by Struts which is useful when an integration is required between Struts and Servlet based application.

82. 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.

83. 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:

84. How nested beans can be used in Struts applications?


Struts provide a separate tag library (Nested Tag Library) for this purpose. Using this library, we can nest the beans in any Struts based application.

85. Which technologies can be used at View Layer in Struts?


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

  • JSP
  • HTML
  • WML Files
  • Velocity Templates
  • Servlets

86. Can we handle exceptions in Struts programmatically?


Yes we can handle exceptions in Struts programmatically by using try, catch blocks in the code.

  • try {
  • // Struts code
  • }
  • Catch (Exception e) {
  • // exception handling code
  • }

87. 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.

88. What Are The Tools Used In Debugging?


We generally use logs to see the cause of the issue, where the failure is occurring.

So for iOS – iPhone configuration utility & for Android Monitor.bat, etc can be used.

If you provide logs from these tools to the developer, they can easily understand the cause of the issue.

89. When To Choose Automation Testing And When To Choose Manual Testing?


  • If the application has new functionality
  • If the application requires testing once or twice
  • Automate Testing

90. Mention Few Disadvantages of Automation Testing.


Designing the tools and tests to run software takes a lot of manual, human effort, though there are frameworks and tests ready-made for engineers to use.

Even with automated testing, human error is still a factor – tools can be buggy, inefficient, costly, and sometimes even technologically limited in what kinds of tests they can run on their own.

91. What Are The Pre-requisites To Start Automation Testing?


The first step is to segregate the different test cases that are to be automated. Following this, you must prepare test data as per the needs of the test cases.

Reusable functions need to be written which are frequently used in those test cases. Later test scripts are prepared by using reusable functions and applying loops and conditions wherever necessary.

92. What Are The Differences Between Open Source Tools, Vendor Tools, And In-house Tools?


Open source tools are free to use frameworks and applications.

Engineers build the tool and have the source code available for free on the internet for other engineers to use.

Vendor tools are developed by companies that come with licenses to use, and often cost money.

Since they are developed by an outside source, technical support is often available for use.

Example: vendor tools include WinRunner, SilkTest, Rational Robot, QA Director, QTP, LR, QC, RFT, and RPT.

93. Is Automation Testing A Complete Replacement For Manual Software Testing?


No. Proper automation requires as little intervention from humans as possible since the tools used are built to run tests once they are set up.

As convenient as this might be, it should not be a complete replacement for manual testing – only for repetitive tasks like load testing, where thousands of virtual users are required. 

Engineers should not automate things like test scripts if those scripts can only be expected to run occasionally, nor should they automate code reviews, or bug testing for new builds of software that might require human interaction to detect issues. We can conclude by saying that large-scale, repetitive tasks are a better fit for automation.

94. How action mapping is configured in Struts?


Action mappings are configured in the configuration file struts-config.xml under the tag <action-mapping> as follows:

  • <pre><action-mappings>
  • <action path=”/login”
  • type=”login.loginAction”
  • name=”loginForm”
  • input=”/login.jsp”
  • scope=”request”
  • validate=”true”>
  • <forward name=”success” path=”/index.jsp”/>
  • <forward name=”failure” path=”/login_error.jsp”/>
  • </action>
  • </action-mappings>

95. When should be opt for Struts Framework?


Struts should be used when any or some of the following conditions are true:

  • A highly robust enterprise level application development is required.
  • A reusable, highly configurable application is required.
  • A loosely coupled, MVC based application is required with clear segregation of different layers.

96. 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 on singleton design patter as only one object needs to be created for this controller class. Multiple threads are created later for each user request.

97. What are the steps required for setting up validator framework in Struts?


Following Steps are required to setup validator framework in Struts: – Wrong Spelling

1. In WEB-INF directory place valdator-rules.xml and validation.xml files.

2. Enable validation plugin in struts-config.xml files by adding following:

  • <plug-in className=”org.apache.struts.validator.ValidatorPlugIn”>
  • <set-property >

Are you looking training with Right Jobs?

Contact Us

Popular Courses