Computer Knowledge

Java Enterprise and Web Technologies

2,183 Questions

Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.

HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts

Java Enterprise and Web Technologies Questions

Multiple choice technology programming languages
  1. HttpServletReuest reuest, HttpServletResponse response

  2. HttpServletReuest reuest,ActionMapping mapping

  3. ActionMapping mapping,HttpServletReuest reuest

  4. ActionMapping mapping,HttpServletResponse response

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The validate() method in Struts ActionForm has the signature validate(ActionMapping mapping, HttpServletRequest request). It receives the mapping configuration and the current request to perform validation on form data. Option C correctly shows ActionMapping first, then HttpServletRequest.

Multiple choice technology programming languages
  1. WorkWeb 2

  2. WebWork 2

  3. Jstruts 2

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Struts 2 was originally called WebWork 2 before the two frameworks merged. WebWork 2 was a separate framework that combined with Struts to create the more modern Struts 2 framework. This is historical knowledge about Struts evolution.

Multiple choice technology programming languages
  1. Sets all properties to their initial value

  2. Sets all properties to null

  3. Repopulates all properties from the request parameters

  4. None of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The reset() method in ActionForm is meant to reset properties to their default values, but it's not automatically implemented to set all properties to null or initial values. Developers must override this method to define what 'reset' means for their specific form. Option C describes what populate/reset cycle does, not reset alone. Option D is correct because none of A, B, or C accurately describe the default behavior.

Multiple choice technology programming languages
  1. Bypass calls to the ActionForm validate method

  2. Bypass validation of the Struts configuration file

  3. Generate an error message if an unknown message key is used

  4. None of Above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The 'validating' init-param in ActionServlet controls whether Struts validates its configuration file (struts-config.xml). Setting it to 'false' or 'no' bypasses this validation during startup. This is useful for faster development cycles or when you're confident the config is correct.

Multiple choice technology programming languages
  1. valuator()

  2. reset()

  3. findForward()

  4. execute()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The execute() method is the core method that every Action class must implement. It handles the request processing logic and returns an ActionForward that determines the view to display. Other methods like reset() belong to ActionForm, and findForward() is called ON an ActionMapping, not implemented BY Action.

Multiple choice technology programming languages
  1. ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response.

  2. Mapping mapping, ActionForm form, ServletRequest request, ServletResponse response.

  3. ActionMapping mapping, Form form, ServletRequest request, ServletResponse response.

  4. ActionMapping mapping, ActionForm form, ServletRequest request, Response response.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The execute() method in Struts Action class takes four parameters: ActionMapping (configuration information), ActionForm (form bean with request parameters), ServletRequest (HTTP request), and ServletResponse (HTTP response). Option B is wrong because 'Mapping' is not a type. Option C is wrong because 'Form' is not a type. Option D is wrong because 'Response' is not a type.

Multiple choice technology programming languages
  1. In Action class

  2. In ActionForm Class

  3. In ActionMapping Class

  4. In ActionServlet Class

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Struts, the key for dispatch actions (like LookupDispatchAction) is generated and stored in the ActionMapping, which contains the configuration information from struts-config.xml. The ActionMapping holds the parameter name that will be used to determine which method to execute. This is part of the mapping configuration.

Multiple choice technology programming languages
  1. ActionServlet

  2. ReuestProcessor

  3. Action

  4. HttpReuest

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The RequestProcessor is responsible for processing requests in Struts, including instantiating ActionForm instances and placing them in the appropriate scope (request, session, or application) based on the scope attribute in the struts-config.xml configuration. Option A is the controller servlet but delegates this work. Option C is incorrect as Action classes execute business logic. Option D is not a class.

Multiple choice technology programming languages
  1. public void reset(ActionMapping mapping, HttpServletReuest reuest)

  2. public ActionErrors reset(ActionMapping mapping, HttpServletReuest reuest)

  3. public ActionError reset(ActionMapping mapping, HttpServletReuest reuest)

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The reset() method in ActionForm returns void and takes ActionMapping and HttpServletRequest as parameters. Option A is correct despite the typos ('HttpServletReuest' and 'reuest'). Options B and C are incorrect because they return ActionErrors/ActionError, which is what validate() returns, not reset(). The purpose of reset() is to initialize form properties, not return validation errors.

Multiple choice technology programming languages
  1. setter,reset

  2. Initialization,setter,reset

  3. setter,reset,Initialization

  4. reset,Initialization,setter

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

ActionForm follows this lifecycle: the form bean is initialized/created, setter methods populate it with request parameters, and reset() is called. Option B correctly sequences these phases.

Multiple choice technology programming languages
  1. ActionErrors

  2. ActionForward

  3. ActionMapping

  4. ActionError

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

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

Multiple choice technology programming languages
  1. Use an asterisk for the path property

  2. Set the "default" property of the mapping to "true"

  3. Set the "unknown" property of the mapping to "true"

  4. Set the "missing" init-param of the ActionServlet to the mapping's path

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Setting the unknown attribute to true on a Struts `` mapping designates it as the default action handler. If an incoming request path does not match any other defined action mapping, Struts routes the request to this action. Other options, such as using asterisks or default properties, are not supported in Struts configuration.

Multiple choice technology programming languages
  1. public void execute(ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws IOException

  2. public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws Exception

  3. public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws Exception

  4. public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws SevletException, IOExpection.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The standard signature of the Struts Action class execute method returns an ActionForward object and accepts ActionMapping, ActionForm, HttpServletRequest, and HttpServletResponse arguments while throwing Exception. Despite minor typographical errors in the options, this signature correctly matches the framework's design, whereas other options have incorrect return types or parameter classes.