programming languages Online Quiz - 221
Description: programming languages Online Quiz - 221 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
In validate method of ActionForm , Parameters are ?
-
HttpServletReuest reuest, HttpServletResponse response
-
HttpServletReuest reuest,ActionMapping mapping
-
ActionMapping mapping,HttpServletReuest reuest
-
ActionMapping mapping,HttpServletResponse response
Other name of Struts 2 was
-
WorkWeb 2
-
WebWork 2
-
Jstruts 2
-
None of the above
The reset method on an ActionForm
-
Sets all properties to their initial value
-
Sets all properties to null
-
Repopulates all properties from the request parameters
-
None of the above
The validating init-param of the ActionServlet is used to
-
Bypass calls to the ActionForm validate method
-
Bypass validation of the Struts configuration file
-
Generate an error message if an unknown message key is used
-
None of Above
To prevent possible security issues with the tag, you should
-
Call the reset method if validation fails
-
Set the tag's redisplay property to false
-
Set the tag's reset property to false
-
Use a plain html tag instea
To localize Validator forms, you can
-
Create separate configuration files for each locale
-
Specify a locale for a form-set
-
Either A or B
-
None of Above
Which method is necessary for Action class?
-
valuator()
-
reset()
-
findForward()
-
execute()
The parameters passed into execute() method is?
-
ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response.
-
Mapping mapping, ActionForm form, ServletRequest request, ServletResponse response.
-
ActionMapping mapping, Form form, ServletRequest request, ServletResponse response.
-
ActionMapping mapping, ActionForm form, ServletRequest request, Response response.
Where key will generated?
-
In Action class
-
In ActionForm Class
-
In ActionMapping Class
-
In ActionServlet Class
The class instantiates ActionForm and puts it in appropriate scope based on scope tag?
-
ActionServlet
-
ReuestProcessor
-
Action
-
HttpReuest
reset() method signature in ActionForm ?
-
public void reset(ActionMapping mapping, HttpServletReuest reuest)
-
public ActionErrors reset(ActionMapping mapping, HttpServletReuest reuest)
-
public ActionError reset(ActionMapping mapping, HttpServletReuest reuest)
-
None of the above
AI Explanation
To answer this question, we need to understand the purpose of the reset()
method in an ActionForm class.
The reset()
method in an ActionForm class is used to reset the form fields to their default values. It is typically called before the form is displayed to the user or when the form is submitted without any input.
Now let's analyze each option:
A) public void reset(ActionMapping mapping, HttpServletRequest request)
- This option is correct because it has the correct method signature for the reset()
method in an ActionForm class. It takes two parameters: ActionMapping
and HttpServletRequest
. The ActionMapping
parameter represents the mapping information for the current action, and the HttpServletRequest
parameter represents the current HTTP request.
B) public ActionErrors reset(ActionMapping mapping, HttpServletRequest request)
- This option is incorrect because the return type is ActionErrors
, which is used to store any validation errors. The reset()
method in an ActionForm class should have a void return type.
C) public ActionError reset(ActionMapping mapping, HttpServletRequest request)
- This option is incorrect because the return type is ActionError
, which represents a single validation error. The reset()
method in an ActionForm class should have a void return type.
D) None of the above - This option is incorrect because option A is the correct answer.
Therefore, the correct answer is option A) public void reset(ActionMapping mapping, HttpServletRequest request)
. This option has the correct method signature for the reset()
method in an ActionForm class.
Correct seuence of ActionForm execution?
-
setter,reset
-
Initialization,setter,reset
-
setter,reset,Initialization
-
reset,Initialization,setter
What does validate () method of ActionForm returns?
-
ActionErrors
-
ActionForward
-
ActionMapping
-
ActionError
To answer this question, the user needs to know about the validate() method of ActionForm in Java.
The validate() method of ActionForm is used to validate the form data submitted by the user. It returns an object of the ActionErrors class, which contains a list of errors that occurred during the validation process.
Therefore, the correct answer is:
The Answer is: A. ActionErrors
If validate="false" in struts-config.xml action tag?
-
Validate() method of ActionForm called automatically
-
Validate() method of Action called automatically
-
Validate() method of ActionForm Not Called automatically
-
None Of the above
AI Explanation
To answer this question, we need to understand the purpose of the validate
attribute in the `tag of the
struts-config.xml` file in the Struts framework.
The validate
attribute is used to specify whether the validate()
method of the associated ActionForm
class should be automatically called before executing the action.
When the validate
attribute is set to "true"
, the validate()
method of the associated ActionForm
class is called automatically. This allows for server-side validation of the form inputs before processing the action.
On the other hand, when the validate
attribute is set to "false"
, the validate()
method of the associated ActionForm
class will not be called automatically. This means that the server-side validation of the form inputs will not be performed before executing the action.
Based on this understanding, let's go through each option:
Option A) Validate() method of ActionForm called automatically
This option is incorrect because when validate="false"
, the validate()
method of the ActionForm
class is not called automatically.
Option B) Validate() method of Action called automatically
This option is incorrect because the validate()
method of the Action
class is not directly related to the validate
attribute in the `tag. The
validate()method of the
Actionclass is responsible for implementing any additional validation logic specific to the action, and it is not affected by the
validate` attribute.
Option C) Validate() method of ActionForm Not Called automatically
This option is correct. When validate="false"
, the validate()
method of the associated ActionForm
class will not be called automatically.
Option D) None of the above This option is incorrect because option C is the correct answer.
Therefore, the correct answer is C. The validate()
method of the ActionForm
class is not called automatically when validate="false"
in the `tag of the
struts-config.xml` file.
How to trigger validate () method of ActionForm?
-
validate="false"
-
validate="true"
-
validate="yes"
-
validate="no"
AI Explanation
To trigger the validate()
method of an ActionForm, you need to set the validate
attribute to "true".
Explanation of each option:
A. validate="false"
: This option will not trigger the validate()
method of the ActionForm. It disables the validation process.
B. validate="true"
: This option will trigger the validate()
method of the ActionForm. It enables the validation process.
C. validate="yes"
: This option is not a valid attribute value for the validate
attribute. It will not trigger the validate()
method.
D. validate="no"
: This option is not a valid attribute value for the validate
attribute. It will not trigger the validate()
method.
Therefore, the correct answer is B) validate="true"
. This option enables the validation process and triggers the validate()
method of the ActionForm.
Struts Framework is well suited for application of ____ size
-
Small
-
Any
-
Average
-
Verysmall
AI Explanation
To answer this question, you need to understand the characteristics and features of the Struts Framework.
The Struts Framework is an open-source framework that is well-suited for developing web applications. It follows the Model-View-Controller (MVC) architectural pattern, which helps in separating the different layers of an application.
The Struts Framework is designed to be flexible and scalable, making it suitable for applications of different sizes. It provides various features like request handling, validation, data binding, and error handling, which can be utilized in applications of any size.
Therefore, the correct answer is:
B) Any - The Struts Framework is well-suited for applications of any size.
To specify an ActionMapping to use when a request doesn't match any other mapping, you can
-
Use an asterisk for the path property
-
Set the "default" property of the mapping to "true"
-
Set the "unknown" property of the mapping to "true"
-
Set the "missing" init-param of the ActionServlet to the mapping's path
How can we retrieve keyed values from a previously defined resource bundle?
-
Using
-
Using
-
Using
-
Using
Which is correct execute method of Action class?
-
public void execute(ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws IOException
-
public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws Exception
-
public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws Exception
-
public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws SevletException, IOExpection.