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

  2. False

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

Static variables are shared only within a single JVM instance. Each server runs its own JVM with its own memory space, so static variables are not shared across different servers. Each servlet instance on each server has its own separate copy of the static variable.

Multiple choice technology programming languages
  1. HTTPRequest.setUserName()

  2. HttpServletRequest.getUserName()

  3. HTTPResponse.setUserName()

  4. HTTPResponse.getUserName()

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

In Java Servlets, user authentication information is accessed through the HttpServletRequest object using getRemoteUser() for basic authentication or getUserPrincipal() for form-based authentication. The HttpServletRequest interface provides methods to retrieve authentication data, not HTTPRequest, HTTPResponse, or setUserName methods.

Multiple choice technology web technology
  1. Action

  2. ActionServlet

  3. HttpServlet

  4. Servlet

  5. None of the above

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

Action classes contain the business logic and handle request processing in Struts. ActionServlet is the main controller servlet that receives all requests and routes them to appropriate Action classes. HttpServlet is the base servlet class but not specific to Struts, and Servlet is too generic.

Multiple choice technology web technology
  1. web.xml

  2. validator-rules.xml

  3. struts-config.xml

  4. application.xml

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

The struts-config.xml file is the default configuration file in Struts framework. It defines action mappings, form beans, forwards, and other framework configurations. web.xml is for general servlet configuration, validator-rules.xml is for validation rules, and application.xml is for J2EE applications.

Multiple choice technology web technology
  1. sfController

  2. sfRequest

  3. sfResponse

  4. sfConcept

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

Symfony (specifically Symfony 1.x legacy core classes) utilizes sfController to handle execution flow, sfRequest to represent the HTTP request, and sfResponse to represent the HTTP response. sfConcept is not a class or core component in the Symfony framework.

Multiple choice technology web technology
  1. A presentation technology

  2. A technology for specifying business rules

  3. A persistence technology

  4. None of the above

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

The claimed answer is A. JSF (JavaServer Faces) is primarily a presentation technology for building user interfaces in Java web applications. It is not a business rules specification technology (Option B) or a persistence technology (Option C). JSF handles the presentation layer through UI components and managed beans.

Multiple choice technology web technology
  1. There will be an server error.

  2. We will stay on the same page.

  3. We will land on the login Page.

  4. There is no h:commandLink tag.

  5. We will land on the powerRangers Page.

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

The outcome returned by the link is 'hugo', which does not match any of the defined `` cases ('Hello' or 'Turtle') in the navigation rule. In JSF, if no navigation case matches the returned outcome, the navigation handler keeps the user on the current page.

Multiple choice technology web technology
  1. True

  2. False

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

The claimed answer is False (B). JSF navigation rules using do not support EL expressions in the view path. Navigation rules are static configuration defined in faces-config.xml, and EL expressions like #{myBean.id} cannot be used directly in the tag. Dynamic navigation with parameters would be handled differently in the action method or through other mechanisms.

Multiple choice technology web technology
  1. Throws an exception.

  2. Executes the action method and throws an exception.

  3. Executes the action method and renders current view.

  4. Controller will be in the same page

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

The claimed answer is C. When a commandLink or commandButton action method returns null, JSF executes the action method but then re-renders the current view instead of navigating to a different page. Option A and B are incorrect because no exception is thrown. Option D is misleading - it's not just 'same page', it's explicitly re-rendering the current view after action execution.

Multiple choice technology web technology
  1. True

  2. False

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

JSF provides built-in standard error messages for conversion and validation failures. These messages are automatically displayed in h:messages or h:message tags when conversion or validation errors occur, though they can be customized via message bundles.

Multiple choice technology web technology
  1. True

  2. False

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

The processDecodesWithoutValidation method in JSF does exactly what its name suggests: it executes the Apply Request Values phase and decodes parameters without running validation. This is useful for scenarios where you want to process submitted data but skip validation logic. The method will handle RuntimeExceptions appropriately, but its key characteristic is bypassing the validation phase for immediate components.

Multiple choice technology web technology
  1. Servlet

  2. Servlet Filter

  3. JSP

  4. None of The Above

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

In Struts 2, the first entry point in the request processing lifecycle is a Servlet Filter (FilterDispatcher or StrutsPrepareAndExecuteFilter). This filter intercepts all requests and dispatches them to the appropriate action. This is different from Struts 1 which used a central ActionServlet.

Multiple choice technology web technology
  1. Unchecked

  2. Checked

  3. All of the Above

  4. None of the Above

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

The Struts 2 exception handling mechanism primarily handles unchecked exceptions (RuntimeException and its subclasses). Checked exceptions need to be caught and handled by the application code or wrapped in runtime exceptions. The exception mapping in struts.xml works with unchecked exceptions.