InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is Struts.devmode? |
|
Answer» 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". 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". |
|
| 2. |
What Is Dispatchaction? |
|
Answer» 1.The DispatchAction enable the programmer to combine together related function or class. 1.The DispatchAction enable the programmer to combine together related function or class. |
|
| 3. |
How Exceptions Are Handled In Struts Application? |
|
Answer» Exceptions are handled in struts by using any one of the following TWO ways: Exceptions are handled in struts by using any one of the following two ways: |
|
| 4. |
What Are The Different Kinds Of Actions In Struts? |
|
Answer» The DIFFERENT KINDS of ACTIONS in STRUTS are: The different kinds of actions in Struts are: |
|
| 5. |
What Design Patterns Are Used In Struts? |
|
Answer» Struts is based on model 2 MVC (Model-View-Controller) ARCHITECTURE. Struts controller USES the command DESIGN pattern and the action classes use the adapter design pattern. The process() METHOD of the RequestProcessor uses the template method design pattern. Struts also implement the following J2EE design patterns.
Struts is based on model 2 MVC (Model-View-Controller) architecture. Struts controller uses the command design pattern and the action classes use the adapter design pattern. The process() method of the RequestProcessor uses the template method design pattern. Struts also implement the following J2EE design patterns.
|
|
| 6. |
When Should Be Opt For Struts Framework? |
|
Answer» Struts should be used when any or some of the following conditions are true:
Struts should be used when any or some of the following conditions are true:
|
|
| 7. |
What Are The Core Classes Of Struts Framework? |
|
Answer» FOLLOWING are the CORE classes PROVIDED by Struts Framework:
Following are the core classes provided by Struts Framework:
|
|
| 8. |
What Configuration Changes Are Required To Use Resource Files In Struts? |
|
Answer» RESOURCE files (.properties files) can be used in Struts by ADDING FOLLOWING CONFIGURATION entry in struts-config.xml file:
Resource files (.properties files) can be used in Struts by adding following configuration entry in struts-config.xml file:
|
|
| 9. |
Is Struts Thread Safe? |
|
Answer» 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. 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. |
|
| 10. |
Which Model Components Are Supported By Struts? |
|
Answer» 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. 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. |
|
| 11. |
How Many Servlet Controllers Are Used In A Struts Application? |
|
Answer» 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. 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. |
|
| 12. |
What’s The Use Of Resourcebundle.properties File In Struts Validation Framework? |
|
Answer» resourcebundle.properties file is used to define specific error messages in key value pairs for any possible errors that MAY OCCUR in the code. resourcebundle.properties file is used to define specific error messages in key value pairs for any possible errors that may occur in the code. |
|
| 13. |
What Are Disadvantages Of Struts? |
|
Answer» Although Struts have large number of advantages associated, it also requires bigger learning curve and also reduces TRANSPARENCY in the development process. Although Struts have large number of advantages associated, it also requires bigger learning curve and also reduces transparency in the development process. |
|
| 14. |
How Properties Of A Form Are Validated In Struts? |
|
Answer» For validation of populated PROPERTIES, VALIDATE() method of ACTIONFORM class is used before handling the control of formbean to ACTION class. For validation of populated properties, validate() method of ActionForm class is used before handling the control of formbean to Action class. |
|
| 15. |
Why Actionservlet Is Singleton In Struts? |
|
Answer» 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. 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. |
|
| 16. |
What Are The Benefits Of Struts Framework? |
|
Answer» 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. 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. |
|
| 17. |
What Is Actionmapping? |
|
Answer» Action mapping contains all the deployment information for a particular Action BEAN. This class is to DETERMINE where the RESULTS of the Action will be sent once its processing is COMPLETE. Action mapping contains all the deployment information for a particular Action bean. This class is to determine where the results of the Action will be sent once its processing is complete. |
|
| 18. |
What’s The Significance Of Logic Tags In Struts? |
|
Answer» Use of logic TAGS in Struts helps in writing a clean and efficient code at presentation LAYER without use of SCRIPTLETS. Use of logic tags in Struts helps in writing a clean and efficient code at presentation layer without use of scriptlets. |
|
| 19. |
What’s The Use Of Struts.xml Configuration File? |
|
Answer» 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. 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. |
|
| 20. |
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 SPECIFIC Java bean while in validator-rules.xml file, standard and generic validation rules are DEFINED. 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. |
|
| 21. |
Which Configuration File Is Used For Storing Jsp Configuration Information In Struts? |
|
Answer» For JSP CONFIGURATION DETAILS, Web.xml FILE is USED. For JSP configuration details, Web.xml file is used. |
|
| 22. |
In Struts, How Can We Access Java Beans And Their Properties? |
|
Answer» Bean TAG Library is a Struts library which can be USED for ACCESSING Java BEANS. Bean Tag Library is a Struts library which can be used for accessing Java beans. |
|
| 23. |
How Duplicate Form Submission Can Be Controlled In Struts? |
|
Answer» In Struts, ACTION class provides two IMPORTANT methods which can be used to avoid duplicate form submissions. In Struts, action class provides two important methods which can be used to avoid duplicate form submissions. |
|
| 24. |
What Are The Steps Of Struts Installation? |
|
Answer» 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. 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. |
|
| 25. |
What’s The Role Of Action Class In Struts? |
|
Answer» In Struts, Action Class acts as a CONTROLLER and performs following KEY tasks: In Struts, Action Class acts as a controller and performs following key tasks: |
|
| 26. |
Which File Is Used By Controller To Get Mapping Information For Request Routing? |
|
Answer» 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.It WORK as the ROUTER in the network and process and MAP the request to the associated action or resource. 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.It work as the router in the network and process and map the request to the associated action or resource. |
|
| 27. |
What Is The Advantage Of Having A Pojo Class As An Action? |
|
Answer» The POJO class is light WEIGHT and EASY to test with frameworks like Junit. MOREOVER, there is no need to create separate ActionForms as in struts one to HOLD the values from the source WEB page. It is done by a single POJO class in struts 2. The POJO class is light weight and easy to test with frameworks like Junit. Moreover, there is no need to create separate ActionForms as in struts one to hold the values from the source web page. It is done by a single POJO class in struts 2. |
|
| 28. |
What Are The Components Of Struts Framework? |
|
Answer» Struts framework is composed of following components: Struts framework is composed of following components: |
|