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 web technology
  1. ServletRequestAware

  2. ServletResponseAware

  3. ActionSupport

  4. All of them

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

To receive the HttpServletRequest instance in a Struts 2 Action class, you implement the ServletRequestAware interface. This interface's setServletRequest(HttpServletRequest) method is called by Struts 2 before the action executes, injecting the request object. ServletResponseAware is for responses, ActionSupport is a convenience base class.

Multiple choice technology web technology
  1. True

  2. False

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

Action classes in Struts 2 are instantiated on a per-request basis by default. Each request creates a new instance of the action class, which makes actions thread-safe and stateless. This is a key difference from some frameworks where actions might be singletons. The Struts 2 interceptor stack and valueStack work with this per-request instance model.

Multiple choice technology web technology
  1. True

  2. False

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

JSF includes standard message bundles with predefined error messages for conversion and validation failures. These messages are automatically associated with components and displayed using or tags when errors occur during the Process Validations or Update Model Values phases.

Multiple choice technology
  1. Basic Components for Java

  2. Basic Controller for Java

  3. Business Components for Java

  4. Business Controller for Java

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

BC4J (Business Components for Java) is Oracle's framework for building J2EE business applications. It provides a layer of abstraction over database operations and follows the MVC pattern. Option C correctly identifies this expansion.

Multiple choice technology programming languages
  1. request

  2. session

  3. context

  4. page

  5. error

  6. exception

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

JSP implicit objects are automatically available in JSP pages without declaration. The standard implicit objects are: request, response, pageContext, session, application (not 'context'), out, config, page, and exception (only in error pages). 'context' is not a valid implicit object name - the correct names are 'application' for servlet context and 'pageContext' for page context.

Multiple choice technology web technology
  1. GenericServlet is for servlets that might not use HTTP, like for instance FTP service.

  2. As of only Http is implemented completely in GenericServlet.

  3. The GenericServlet has a service() method that gets called when a client request is made.

  4. GenericServlet is called by both incoming requests and the HTTP requests are given to the servlet as they are.

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

GenericServlet is a protocol-independent servlet class. It defines a lifecycle method service() called for all client requests. Unlike HttpServlet, it does not implement HTTP-specific behavior directly. The marked options correctly describe its protocol-neutral design and request handling workflow.

Multiple choice technology web technology
  1. Separation of dynamic and static content.

  2. Support for scripting and tags

  3. Reuse of components and tags.

  4. Web access layer for N-tier enterprise application architecture

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

JSP technology provides all four listed advantages: separation of dynamic/static content through its template mechanism, support for scripting and custom tag libraries, component/tag reuse through JavaBeans and custom tags, and serving as the presentation layer in N-tier enterprise architecture.

Multiple choice technology web technology
  1. Objects with application scope are accessible from pages processing requests that are in the same application as they one in which they were created.

  2. All references to the object shall be released when the runtime environment reclaims the ServletContext.

  3. Objects with application scope can be defined (and reached) from pages that are not session-aware

  4. References to objects with application scope are stored in the application object associated with a page activation

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

All four statements correctly describe application scope in JSP. Objects with application scope are accessible across the entire application (all requests/sessions), persist until the ServletContext is destroyed/reclaimed, can be accessed from non-session-aware pages, and are stored in the implicit application object.

Multiple choice technology web technology
  1. cookie.setMaxAge(int seconds)

  2. cookie.setMaxAge(float seconds)

  3. cookie.setAgeMax (float seconds)

  4. cookie.setAgeMax (int seconds)

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

The Cookie class in Java servlets/JSP uses setMaxAge(int seconds) to set the cookie's maximum age in seconds. The parameter must be an integer, not a float. Negative values delete the cookie, zero deletes it immediately, and positive values set the expiration time.

Multiple choice technology web technology
  1. _jspService()

  2. jspInit()

  3. jspDestroy()

  4. getParameter()

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

In JSP, only jspInit() and jspDestroy() can be overridden by developers. The _jspService() method is generated by the container and cannot be overridden (it's marked final in the generated servlet). getParameter() is a method of ServletRequest interface, not a JSP lifecycle method.

Multiple choice technology web technology
  1. HTTP Communication (Text-based and object-based)

  2. Socket Communication

  3. RMI Communication

  4. None of these

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

Applets can communicate with servlets using HTTP requests (sending text or serialized objects), direct TCP/IP sockets, or Remote Method Invocation (RMI). Since all three communication mechanisms are valid, marking them all as correct in this multiple-response question is accurate.