This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
In Which Order Struts Framework Searches For A Message Bundle? |
|
Answer» When you reference a MESSAGE ELEMENT by its key, Struts FRAMEWORK SEARCHES for a corresponding message bundle in the following ORDER −
When you reference a message element by its key, Struts framework searches for a corresponding message bundle in the following order − |
|
| 2. |
What Is The Naming Convention For A Resource Bundle File In Struts2? |
|
Answer» The SIMPLEST naming format for a resource file is − bundlename_language_country.properties Here bundlename could be ActionClass, Interface, SuperClass, MODEL, Package, Global resource properties. NEXT PART language_country represents the country locale for example Spanish (Spain) locale is represented by es_ES and English (UNITED States) locale is represented by en_US etc. Here you can skip country part which is optional. The simplest naming format for a resource file is − bundlename_language_country.properties Here bundlename could be ActionClass, Interface, SuperClass, Model, Package, Global resource properties. Next part language_country represents the country locale for example Spanish (Spain) locale is represented by es_ES and English (United States) locale is represented by en_US etc. Here you can skip country part which is optional. |
|
| 3. |
How Struts2 Supports Internationalization? |
|
Answer» Struts2 provides localization ie. INTERNATIONALIZATION (i18n) support through resource bundles, interceptors and tag libraries in the FOLLOWING places − Struts2 provides localization ie. internationalization (i18n) support through resource bundles, interceptors and tag libraries in the following places − |
|
| 4. |
What Types Of Validations Are Available In Xml Based Validation In Struts2? |
|
Answer» FOLLOWING is the list of various types of FIELD level and non-field level validation available in Struts2 −
Following is the list of various types of field level and non-field level validation available in Struts2 − |
|
| 5. |
What Should Be The Name Of Xml File Used For Validation In Struts? |
|
Answer» The XML FILE NEEDS to be NAMED '[action-class]'-validation.xml. The xml file needs to be named '[action-class]'-validation.xml. |
|
| 6. |
What Is Xml Based Validation In Struts2? |
|
Answer» The second method of doing VALIDATION is by placing an xml FILE next to the action class. Struts2 XML based validation PROVIDES more options of validation like EMAIL validation, integer range validation, form validation field, expression validation, regex validation, REQUIRED validation, requiredstring validation, stringlength validation and etc. The second method of doing validation is by placing an xml file next to the action class. Struts2 XML based validation provides more options of validation like email validation, integer range validation, form validation field, expression validation, regex validation, required validation, requiredstring validation, stringlength validation and etc. |
|
| 7. |
How Struts 2 Validation Works? |
Answer»
|
|
| 8. |
What Is Structs 2 Validation Framework? |
|
Answer» At Struts's core, we have the validation FRAMEWORK that assists the APPLICATION to run the rules to perform validation before the ACTION method is executed. Action class should extend the ActionSupport class, in order to get the VALIDATE method executed. At Struts's core, we have the validation framework that assists the application to run the rules to perform validation before the action method is executed. Action class should extend the ActionSupport class, in order to get the validate method executed. |
|
| 9. |
How To Override The Default Error Message That Can Come During File Uploading Process? |
|
Answer» You can OVERRIDE the TEXT of these MESSAGES in WebContent/WEB-INF/classes/messages.properties RESOURCE FILES. You can override the text of these messages in WebContent/WEB-INF/classes/messages.properties resource files. |
|
| 10. |
What Are The Struts2 Error Message Keys That Can Come During File Uploading Process? |
|
Answer» The fileUplaod interceptor uses several default error MESSAGE keys − struts.messages.error.uploading − A GENERAL error that occurs when the file could not be uploaded. struts.messages.error.file.too.large − Occurs when the uploaded file is too large as SPECIFIED by maximumSize. struts.messages.error.CONTENT.type.not.allowed − Occurs when the uploaded file does not match the EXPECTED content types specified. The fileUplaod interceptor uses several default error message keys − struts.messages.error.uploading − A general error that occurs when the file could not be uploaded. struts.messages.error.file.too.large − Occurs when the uploaded file is too large as specified by maximumSize. struts.messages.error.content.type.not.allowed − Occurs when the uploaded file does not match the expected content types specified. |
|
| 11. |
What Are The Struts2 Configuration Properties That Control File Uploading Process? |
|
Answer» Following are the Struts2 configuration properties that control file uploading process − struts.multipart.maxSize − The maximum SIZE (in bytes) of a file to be accepted as a file upload. Default is 250M. struts.multipart.parser − The LIBRARY used to upload the multipart FORM. By default is JAKARTA. struts.multipart.saveDir − The location to store the temporary file. By default is javax.servlet.context.tempdir. Following are the Struts2 configuration properties that control file uploading process − struts.multipart.maxSize − The maximum size (in bytes) of a file to be accepted as a file upload. Default is 250M. struts.multipart.parser − The library used to upload the multipart form. By default is jakarta. struts.multipart.saveDir − The location to store the temporary file. By default is javax.servlet.context.tempdir. |
|
| 12. |
Which Interceptor Is Responsible For File Upload Support? |
|
Answer» FILE UPLOADING in Struts is possible through a pre-defined interceptor called FileUpload interceptor which is available through the org.apache.struts2.interceptor.FileUploadInterceptor CLASS and included as PART of the defaultStack. File uploading in Struts is possible through a pre-defined interceptor called FileUpload interceptor which is available through the org.apache.struts2.interceptor.FileUploadInterceptor class and included as part of the defaultStack. |
|
| 13. |
Which Components Are Available Using Actioncontext Map? |
|
Answer» The ACTIONCONTEXT map consists of the following − application − application scoped variables. SESSION − session scoped variables. root / value STACK − all your action variables are stored here. REQUEST − request scoped variables. parameters − request parameters. atributes − the attributes stored in page, request, session and application scope. The ActionContext map consists of the following − application − application scoped variables. session − session scoped variables. root / value stack − all your action variables are stored here. request − request scoped variables. parameters − request parameters. atributes − the attributes stored in page, request, session and application scope. |
|
| 14. |
What Is Ognl? |
|
Answer» The Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to REFERENCE and MANIPULATE data on the ValueStack. OGNL ALSO helps in data TRANSFER and type conversion. The Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and manipulate data on the ValueStack. OGNL also helps in data transfer and type conversion. |
|
| 15. |
What Is Value Stack? |
|
Answer» The VALUE stack is a set of several objects which keeps the following objects in the provided order − TEMPORARY Objects − There are various temporary objects which are created during execution of a page. For example the current iteration value for a collection being looped over in a JSP tag. The Model Object − If you are using model objects in your struts application, the current model object is placed before the action on the value stack. The Action Object − This will be the current action object which is being EXECUTED. NAMED Objects − These objects include #application, #SESSION, #request, #attr and #parameters and refer to the corresponding servlet scopes. The value stack is a set of several objects which keeps the following objects in the provided order − Temporary Objects − There are various temporary objects which are created during execution of a page. For example the current iteration value for a collection being looped over in a JSP tag. The Model Object − If you are using model objects in your struts application, the current model object is placed before the action on the value stack. The Action Object − This will be the current action object which is being executed. Named Objects − These objects include #application, #session, #request, #attr and #parameters and refer to the corresponding servlet scopes. |
|
| 16. |
What Is The Purpose Of Redirect Result Type? |
|
Answer» The redirect result type calls the standard response.sendRedirect() method, causing the browser to CREATE a new request to the given location. We can PROVIDE the location either in the body of the <result...> ELEMENT or as a <param name="location"> element. The redirect result type calls the standard response.sendRedirect() method, causing the browser to create a new request to the given location. We can provide the location either in the body of the <result...> element or as a <param name="location"> element. |
|
| 17. |
What Is The Purpose Of Dispatcher Result Type? |
|
Answer» The DISPATCHER result TYPE is the default type, and is USED if no other result type is specified. It's used to forward to a servlet, JSP, HTML page, and so on, on the server. It uses the RequestDispatcher.forward() method. The dispatcher result type is the default type, and is used if no other result type is specified. It's used to forward to a servlet, JSP, HTML page, and so on, on the server. It uses the RequestDispatcher.forward() method. |
|
| 18. |
What Is Defeult Result Type? |
|
Answer» DEFAULT result type is DISPATCHER, which is used to dispatch to JSP PAGES. Default result type is dispatcher, which is used to dispatch to JSP pages. |
|
| 19. |
What Are Result Types In Struts? |
|
Answer» The ACTION CLASS MANAGES the APPLICATION's state, and the Result TYPE manages the view. The Action class manages the application's state, and the Result Type manages the view. |
|
| 20. |
How Interceptor Works In Struts 2? |
Answer»
|
|
| 21. |
How Can You Create Your Custom Interceptor In Struts 2? |
|
Answer» Creating a custom INTERCEPTOR is easy; the INTERFACE that NEEDS to be extended is the Interceptor interface. Creating a custom interceptor is easy; the interface that needs to be extended is the Interceptor interface. |
|
| 22. |
What Are Interceptors In Struts 2? |
|
Answer» Interceptors are conceptually the same as SERVLET filters or the JDKs Proxy class. Interceptors ALLOW for crosscutting functionality to be implemented separately from the action as WELL as the framework. You can achieve the FOLLOWING using interceptors :
Interceptors are conceptually the same as servlet filters or the JDKs Proxy class. Interceptors allow for crosscutting functionality to be implemented separately from the action as well as the framework. You can achieve the following using interceptors : |
|
| 23. |
What Is The Purpose Of Struts.properties In Struct2? |
|
Answer» This configuration file provides a mechanism to change the default behavior of the framework. Actually all of the properties contained within the STRUTS.properties configuration file can also be configured in the web.xml using the init-param, as WELL using the constant tag in the struts.xml configuration file. But if you like to keep the things SEPARATE and more struts SPECIFIC then you can create this file under the FOLDER WEB-INF/classes. The values configured in this file will override the default values configured in default.properties which is contained in the struts2-core-x.y.z.jar distribution. This configuration file provides a mechanism to change the default behavior of the framework. Actually all of the properties contained within the struts.properties configuration file can also be configured in the web.xml using the init-param, as well using the constant tag in the struts.xml configuration file. But if you like to keep the things separate and more struts specific then you can create this file under the folder WEB-INF/classes. The values configured in this file will override the default values configured in default.properties which is contained in the struts2-core-x.y.z.jar distribution. |
|
| 24. |
What Is The Purpose Of Plug-in Tag In Struct-config.xml? |
|
Answer» This SECTION tells STRUTS where to find your properties FILES, which CONTAIN prompts and error messages. This section tells Struts where to find your properties files, which contain prompts and error messages. |
|
| 25. |
What Is The Purpose Of Action-mappings Tag In Struct-config.xml? |
|
Answer» This is where you declare FORM handlers and they are also known as ACTION MAPPINGS. This is where you declare form handlers and they are also known as action mappings. |
|
| 26. |
What Is The Purpose Of Global-forwards Tag In Struct-config.xml? |
|
Answer» This SECTION maps a PAGE on your webapp to a name. You can use this name to REFER to the actual page. This AVOIDS hardcoding URLs on your web pages. This section maps a page on your webapp to a name. You can use this name to refer to the actual page. This avoids hardcoding URLs on your web pages. |
|
| 27. |
What Is The Purpose Of Form-beans Tag In Struct-config.xml? |
|
Answer» This is where you map your ACTIONFORM subclass to a NAME. You use this name as an ALIAS for your ActionForm THROUGHOUT the rest of the struts-config.xml FILE, and even on your JSP pages. This is where you map your ActionForm subclass to a name. You use this name as an alias for your ActionForm throughout the rest of the struts-config.xml file, and even on your JSP pages. |
|
| 28. |
What Is The Purpose Of Struct-config.xml In Struct2? |
|
Answer» The struts-config.xml configuration file is a LINK between the VIEW and MODEL components in the Web CLIENT. The struts-config.xml configuration file is a link between the View and Model components in the Web Client. |
|
| 29. |
What Is The Purpose Of Action Tag In Struts.xml? |
|
Answer» We DEFINE action tags corresponds to every URL we want to access and we define a class with execute() method which will be accessed whenever we will access CORRESPONDING URL. Results determine what gets RETURNED to the browser after an action is EXECUTED. The string returned from the action should be the name of a result. Results are configured per-action as above, or as a "global" result, available to every action in a package. Results have optional name and type attributes. The default name value is "success". We define action tags corresponds to every URL we want to access and we define a class with execute() method which will be accessed whenever we will access corresponding URL. Results determine what gets returned to the browser after an action is executed. The string returned from the action should be the name of a result. Results are configured per-action as above, or as a "global" result, available to every action in a package. Results have optional name and type attributes. The default name value is "success". |
|
| 30. |
What Is The Purpose Of Constant Tag In Struts.xml? |
|
Answer» The CONSTANT tag along with name and VALUE attributes will be used to override any of the following properties defined in default.properties, like we just SET struts.devMode property. Setting struts.devMode property allows us to see more debug MESSAGES in the log file. The constant tag along with name and value attributes will be used to override any of the following properties defined in default.properties, like we just set struts.devMode property. Setting struts.devMode property allows us to see more debug messages in the log file. |
|
| 31. |
What Is The Purpose Of Struts.xml In Struct2? |
|
Answer» The struts.xml file contains the configuration information that you will be modifying as actions are developed. This file can be USED to override default SETTINGS for an APPLICATION, for example struts.devMode = false and other settings which are defined in property file. This file can be created under the folder WEB-INF/classes. The struts.xml file contains the configuration information that you will be modifying as actions are developed. This file can be used to override default settings for an application, for example struts.devMode = false and other settings which are defined in property file. This file can be created under the folder WEB-INF/classes. |
|
| 32. |
Explain The Life Cycle Of A Request In Struct2 Application? |
|
Answer» Following is the life cycle of a request in Struct2 application −
Following is the life cycle of a request in Struct2 application − |
|
| 33. |
What Are The Core Components Of A Struct2 Based Application? |
|
Answer» The Model-VIEW-Controller PATTERN in Struts2 is realized with following five core components − The Model-View-Controller pattern in Struts2 is realized with following five core components − |
|
| 34. |
Name Some Of The Features Of Struts2? |
|
Answer» Here are some of the great features that MAY force you to consider Struts2 − POJO forms and POJO actions − Struts2 has done away with the Action Forms that were an integral part of the Struts framework. With Struts2, you can use any POJO to receive the form input. Similarly, you can now see any POJO as an Action class. Tag support − Struts2 has improved the form tags and the new tags ALLOW the developers to write LESS code. AJAX support − Struts2 has recognised the take over by Web2.0 technologies, and has integrated AJAX support into the product by creating AJAX tags, that function very similar to the STANDARD Struts2 tags. Easy Integration − Integration with other frameworks like Spring, Tiles and SiteMesh is now easier with a variety of integration available with Struts2. Template Support − Support for generating views USING templates. Plugin Support − The core Struts2 behaviour can be enhanced and augmented by the use of plugins. A number of plugins are available for Struts2. Here are some of the great features that may force you to consider Struts2 − POJO forms and POJO actions − Struts2 has done away with the Action Forms that were an integral part of the Struts framework. With Struts2, you can use any POJO to receive the form input. Similarly, you can now see any POJO as an Action class. Tag support − Struts2 has improved the form tags and the new tags allow the developers to write less code. AJAX support − Struts2 has recognised the take over by Web2.0 technologies, and has integrated AJAX support into the product by creating AJAX tags, that function very similar to the standard Struts2 tags. Easy Integration − Integration with other frameworks like Spring, Tiles and SiteMesh is now easier with a variety of integration available with Struts2. Template Support − Support for generating views using templates. Plugin Support − The core Struts2 behaviour can be enhanced and augmented by the use of plugins. A number of plugins are available for Struts2. |
|
| 35. |
What Is Struts2? |
|
Answer» Struts2 is popular and MATURE WEB application FRAMEWORK based on the MVC design pattern. Struts2 is not just the NEXT version of Struts 1, but it is a COMPLETE rewrite of the Struts architecture. Struts2 is popular and mature web application framework based on the MVC design pattern. Struts2 is not just the next version of Struts 1, but it is a complete rewrite of the Struts architecture. |
|