Computer Knowledge

Java Enterprise and Web Technologies

2,279 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. One per request

  2. One per module

  3. One per session

  4. One per application

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

In Struts 1, Action classes are thread-safe and only one instance of each Action type is created per application (singleton pattern). This single instance handles all requests for that action type concurrently. Since Struts Actions must be thread-safe, they should not have instance state specific to a request. Options A, B, and C are incorrect because Struts does not create new Action instances per request, module, or session.

Multiple choice technology web technology
  1. The managed server which was used by the client for JNDI lokkup of the connection factory

  2. The managed server to which the client has a TCP connection after creating a new connection from the connection factory.

  3. Both the managed servers and in random order

  4. Only to One of the managed server and that can be in any order

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

With server affinity enabled, JMS client connections stick to the managed server where the Connection Factory was first looked up. All messages from that client go to the distribution destination member on that same server. The affinity is based on the TCP connection established after creating the connection from the factory.

Multiple choice technology platforms and products
  1. a thread of foreign jms provider

  2. a thread of weblogic server

  3. depends upon whether MDB is transactional or not. If transactional, it runs under weblogic thread, if non transactional it runs under foreign jms provider thread

  4. depends upon whether MDB is transactional or not. If transactional, it runs under foreign jms provider thread, if non transactional it runs under weblogic thread

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

For foreign JMS providers with WebLogic MDBs, transactional MDBs run under WebLogic threads (managed context), while non-transactional MDBs can run under the foreign provider's threads. WebLogic uses synchronous polling for transactional cases to maintain transactional integrity.

Multiple choice technology platforms and products
  1. True

  2. False

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

WebLogic MDBs listening to foreign JMS queues use synchronous consumer calls internally. The MDB appears to receive messages asynchronously, but under the hood WebLogic makes synchronous receive() calls to the foreign provider to deliver messages to the onMessage method.

Multiple choice technology platforms and products
  1. System

  2. Bootstrap

  3. Internal

  4. Filtering

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

Filtering classloader allows applications to preferentially load classes from their own deployment unit rather than from the server's CLASSPATH, preventing conflicts and ensuring application-specific versions are used. System and Bootstrap classloaders delegate to parent classloaders, while Internal is not a standard WebLogic classloader type.

Multiple choice technology platforms and products
  1. JOLT

  2. SOAP over HTTP

  3. WTC

  4. XML - RPC

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

WTC (WebLogic Tuxedo Connector) provides direct bidirectional communication between WebLogic and Tuxedo domains, while JOLT (Java Open Library for Tuxedo) enables Java applications to make Tuxedo service calls. SOAP over HTTP and XML-RPC are generic web service protocols, not Tuxedo-specific integration mechanisms.

Multiple choice technology embedded technologies
  1. javax.microedition.io.PushRegistry

  2. javax.microedition.io.HttpConnection

  3. javax.microedition.lcdui.TextField

  4. javax.microedition.io.HttpsConnection

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

javax.microedition.lcdui.TextField is a standard user interface component that does not access restricted network or system resources, allowing untrusted MIDlets to use it without explicit user confirmation.

Multiple choice technology web technology
  1. <jsp:declareBean id = "harry" class = "EmployeeBean" scope = "request" />

  2. <jsp:createBean id = "harry" class = "EmployeeBean" />

  3. <jsp:useBean id = "harry" class = "EmployeeBean" scope = "request" />

  4. <jsp:useBean id = "harry" class = "EmployeeBean" />

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

The action with scope="request" creates or retrieves a bean from request scope exactly as the Java code does - if null, it instantiates and stores it. Option D is incomplete (missing scope).

Multiple choice technology web technology
  1. Define a listener class implementing HttpSessionListener and whenever an object is added to Http Session object, keep track of the number of instances.

  2. Define a listener class implementing HttpSessionBindingListener and in the valueBound() method, keep track of the number of instances being added in a static variable.

  3. It is highly impossible to keep track the number of objects being added to a Http Session in a Web Application.

  4. The Servlet API provides direct support for keeping track the object instances.

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

HttpSessionBindingListener is specifically designed for objects to be notified when they are added/removed from a session. The valueBound() method is called when the object is added. HttpSessionListener tracks session lifecycle, not individual objects.

Multiple choice technology web technology
  1. Use the method 'HttpServletRequest.getParameterNames()' which will return an enumeration of parameter names.

  2. Use the method 'HttpServletResponse.getParameterNames()' which will return an enumeration of parameter names.

  3. Use the method 'HttpServletRequest.getAllParameters()' which will return an enumeration of parameter names.

  4. There is no direct support in the Servlet API to retrieve the name of all the parameters sent by the client.

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

HttpServletRequest.getParameterNames() returns an Enumeration containing the names of the parameters contained in the request. The response object does not handle request parameters, and getAllParameters is not a valid method in the Servlet API.

Multiple choice technology web technology
  1. out.println(config.getServletContext().getParameter("app-name")); out.println(config.getInitParameter("app-name"));

  2. out.println(config.getInitParameter("app-name")); out.println(config.getServletContext().getInitParameter("app-name"));

  3. out.println(config.getServletContext().getInitParameter("app-name")); out.println(config.getInitParameter("app-name"));

  4. out.println(config.getServletContext().getInitParameter("app-name")); out.println(config.getParameter("app-name"));

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

Context parameters are accessed via getServletContext().getInitParameter(), while servlet init-params use getInitParameter() on the servlet config. Option C correctly chains these calls.

Multiple choice technology web technology
  1. ${request.getAttribute()}
  2. ${request.attribute}
  3. ${pageContext.request.getAttribute()}
  4. ${pageContext.request.attribute}
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

EL uses property notation, not method calls. ${pageContext.request.attribute} is correct - it accesses the implicit pageContext object, then its request property, then the attribute property (which maps to getAttribute()).

Multiple choice technology web technology
  1. Front Controller

  2. Business Controller

  3. Business Delegate

  4. Intercepting Filter

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

Intercepting Filter pattern is designed for pre/post-processing of requests - authentication, logging, data filtering, etc. Front Controller is about request routing, not preprocessing. Business Delegate/Controller are about separation of concerns.

Multiple choice technology web technology
  1. Use the method 'HttpServletRequest.getParameterNames()' which will return an enumeration of parameter names.

  2. Use the method 'HttpServletResponse.getParameterNames()' which will return an enumeration of parameter names.

  3. Use the method 'HttpServletRequest.getAllParameters()' which will return an enumeration of parameter names.

  4. There is no direct support in the Servlet API to retrieve the name of all the parameters sent by the client.

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

The Servlet API provides getParameterNames() method in HttpServletRequest to retrieve all parameter names sent by the client. This returns an Enumeration of String objects representing parameter names. HttpServletResponse is for sending responses, not reading request parameters. There is no getAllParameters() method.