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 programming languages
  1. Apache web server

  2. java.net.HttpURLConnection class

  3. Java web server Tomcat

  4. None of the Above

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

Java web server Tomcat is a servlet container that implements servlets. Apache web server is a pure HTTP server (not a servlet container), and HttpURLConnection is a client-side class for making HTTP requests.

Multiple choice technology programming languages
  1. out

  2. session

  3. request

  4. response

  5. httpsession

  6. page

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

JSP provides implicit objects like out, request, response, session, and page that can be used directly in expressions. 'httpsession' is not a valid JSP implicit variable - the session object itself is an HttpSession, not a variable called 'httpsession'. Options A, B, C, D, and F are all standard implicit objects available in JSP expressions.

Multiple choice technology programming languages
  1. A. The getRequestDispatcher method of ServletContext class takes the full path of the servlet, whereas the getRequestDispatcher method of HttpServletRequest class takes the path of the servlet relative to the ServletContext.

  2. B. The include method defined in the RequestDispatcher class can be used to access one servlet from another. But it can be invoked only if no output has been sent to the server.

  3. C. The getRequestDispatcher(String URL) is defined in both ServletContext and HttpServletRequest method

  4. D. The getNamedDispatcher(String) defined in HttpServletRequest class takes the name of the servlet and returns an object of RequestDispatcher class.

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

Option A correctly states that ServletContext.getRequestDispatcher uses full paths (starting with '/'), while HttpServletRequest.getRequestDispatcher uses paths relative to the current context. Option C is also correct - both interfaces define getRequestDispatcher with different path resolution rules. Option B is incorrect because include can be invoked after output. Option D is wrong because getNamedDispatcher is in ServletContext, not HttpServletRequest.

Multiple choice technology platforms and products
  1. Rule-Obj-Flow

  2. Rule-Activity

  3. Rule-Obj-Activity

  4. They are each separate rule types

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

Router, Notify, and Utility shapes in Pega flows are all based on the Rule-Obj-Activity rule type. These are technically specialized flow shapes that internally invoke activities. In the Security tab of an Activity rule, you can see that Router, Notify, and Utility are all listed as activity-based rule types. They are not separate rule types from Rule-Obj-Activity - they are specialized implementations that use activities as their foundation.

Multiple choice technology web technology
  1. #{contextPath}

  2. #{requestContextPath}

  3. #{facesContext.externalContext.requestContextPath}

  4. ${request.contextPath}
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In JSF, the full expression #{facesContext.externalContext.requestContextPath} accesses the external context to retrieve the request’s context path, which is the correct way to reference the application’s base URL. The other shorter forms either reference non‑existent properties or use the wrong EL syntax, making them incorrect.

Multiple choice technology databases
  1. doGet()

  2. doTrace()

  3. doOptions()

  4. All the Above

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

HttpServlet class provides doGet(), doTrace(), doOptions(), doPost(), doPut(), doDelete(), and other methods corresponding to HTTP protocol verbs. Since doGet, doTrace, and doOptions are all valid HttpServlet methods, 'All the Above' is the correct answer.

Multiple choice technology databases
  1. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage.

  2. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

  3. JSP and servlets are unrelated technologies.

  4. None of the Above

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

JSP (JavaServer Pages) is built on servlet technology. During deployment, JSP pages are compiled into servlets by the container. Servlets are the underlying technology, not the other way around. JSP provides a template-based approach for generating dynamic content, but ultimately executes as servlets.

Multiple choice technology databases
  1. GenericServlet

  2. HttpServlet

  3. Both (A) and (B)

  4. None of the Above

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

In Java Servlet API, both GenericServlet (a protocol-independent servlet) and HttpServlet (a servlet specifically tailored for HTTP requests) are types of servlets. Therefore, both are valid servlet implementations, making the option "Both (A) and (B)" correct.

Multiple choice technology databases
  1. JSP Page

  2. Java bean

  3. Servlet

  4. Session manager

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

In Page-Centric architecture, the JSP page itself is the initial contact point for handling web requests. Unlike servlet-centric architectures where a servlet receives and processes requests first, page-centric designs route requests directly to JSP pages which may then delegate to beans or other components as needed.

Multiple choice technology databases
  1. doGet() or doPost() method

  2. getServletInfo() method

  3. All of the above

  4. none of the above

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

To process form submissions in a servlet, you subclass HttpServlet and override the doGet() or doPost() methods, depending on the HTTP request method used. The service() method automatically dispatches requests to these methods, so developers rarely need to override service() directly.

Multiple choice technology databases
  1. basicHttpBinding

  2. wsHttpBindging

  3. webHttpBinding

  4. All of the above

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

WCF's webHttpBinding is specifically designed for RESTful services, enabling communication with XML or JSON payloads, which makes it ideal for ASP.NET AJAX clients. The basicHttpBinding and wsHttpBinding are built for SOAP-based web services, which are less suitable for standard Ajax clients.

Multiple choice technology databases
  1. service() method

  2. init() method

  3. constructor for HttpServlet()

  4. None of the Above

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

The init() method is the designated place for servlet initialization code in the Servlet API lifecycle. It's called once when the servlet is first loaded. The service() method handles each request. The constructor is not the standard initialization point for servlets - init() guarantees the ServletConfig is available.

Multiple choice technology databases
  1. ServletContext

  2. Servlet mapping

  3. Lifecycle

  4. None of the Above

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

Servlet mapping is the association between a URL pattern and a servlet, defined in web.xml (or annotations). It tells the container which servlet should handle requests matching specific URL patterns. ServletContext is shared data across servlets. Lifecycle refers to servlet initialization/destruction. The mapping mechanism is essential for routing requests to correct servlets.

Multiple choice technology databases
  1. Servlet Interface

  2. servlet mapping

  3. Servlet Container

  4. None of the Above

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

All Servlets must implement the javax.servlet.Servlet interface, which defines the lifecycle methods (init, service, destroy) that the servlet container calls. Servlet mapping is a configuration concept, and Servlet Container is the runtime environment, not an interface to implement.

Multiple choice technology databases
  1. Apache web server

  2. java.net.HttpURLConnection class

  3. Java web server Tomcat

  4. None of the Above

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

Apache Tomcat is a widely used web server and servlet container that implements the Java Servlet specification. Apache HTTP Server is a general web server without servlet support, and HttpURLConnection is a client-side API class, not a servlet implementation.