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. Asyncronous Java eXtensible Language

  2. Asyncronous Java XML

  3. Asyncronous JavaScript XML

  4. Asyncronous J2EE XML

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

AJAX stands for Asynchronous JavaScript and XML, a set of web development techniques used to create asynchronous web applications. Distractors are incorrect as they substitute JavaScript with Java or J2EE, which are different languages and platforms, or use 'eXtensible Language' instead of 'and XML'.

Multiple choice technology
  1. jspInit(), _jspService() & jspDestroy()

  2. init(), service(), destroy()

  3. both 1&2

  4. none

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

JSP pages are translated into Servlets, and the lifecycle methods reflect this. jspInit() is called once when the JSP is first loaded (like init()). _jspService() handles each request (like service()). jspDestroy() is called when the JSP is unloaded (like destroy()). Options in B are Servlet lifecycle methods, not JSP-specific.

Multiple choice technology
  1. View

  2. Model

  3. Controller

  4. none

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

In MVC architecture, JSP serves as the View layer, responsible for presenting data to users. JSP's strength is templating and rendering HTML with dynamic content. Servlets typically act as Controllers (handling request processing), and JavaBeans/POJOs serve as Models (data and business logic).

Multiple choice technology
  1. Applets

  2. Web Browsers

  3. Wireless clients.

  4. All the above

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

J2EE architecture supports multiple client types. Applets can be J2EE clients (RMI/IIOP), Web Browsers access via HTTP/HTTPS, and Wireless clients (WAP, mobile) access through specialized servlets/JSP. All three are valid J2EE client types, making 'All the above' the correct answer.

Multiple choice technology
  1. True

  2. False

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

In J2EE web applications, all custom servlets handling HTTP requests must extend javax.servlet.http.HttpServlet. This abstract class provides HTTP-specific functionality (doGet, doPost, etc.). While you could technically implement Servlet directly, HttpServlet is the standard base for all HTTP servlets in J2EE.

Multiple choice technology
  1. True

  2. False

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

JSP translation to Servlet happens ONLY ONCE - when the JSP is first accessed. The container generates the Servlet code, compiles it, and loads it. All subsequent requests reuse the same compiled Servlet instance. Translating on every request would destroy performance. This is why JSP changes require redeployment or container restart.

Multiple choice technology
  1. ServletContext gives information about Container

  2. ServletContext gives information about Request

  3. ServletContext gives information about Session

  4. none

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

ServletContext provides information about the servlet container and allows servlets to communicate with it. It gives access to container-wide configuration parameters, resources, and attributes shared across all servlets in the application. It does not provide information about individual requests or sessions - those are handled by HttpServletRequest and HttpSession respectively.

Multiple choice technology
  1. only request, response

  2. only request, response & application

  3. request, response, session & application

  4. none

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

JSP provides several implicit objects automatically available without declaration: request (HttpServletRequest), response (HttpServletResponse), session (HttpSession), and application (ServletContext). These objects handle client requests, server responses, user session management, and application-wide operations respectively. Option C correctly lists four key implicit objects.

Multiple choice technology
  1. True

  2. False

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

When a JSP page is first requested, the web container translates it into a servlet class and creates a servlet instance. This instance then handles all subsequent requests to that JSP. The servlet lifecycle (init, service, destroy) applies to the generated servlet, not directly to the JSP source code. Therefore, a servlet object is indeed created during JSP execution.

Multiple choice technology
  1. ejb-jar.xml

  2. Can be any valid xml containing Web Module name

  3. web.xml

  4. config.xml

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

The web.xml file is the standard deployment descriptor for Java web applications. It contains configuration information for servlets, filters, listeners, welcome files, and other web application components. The web container reads web.xml during deployment to understand how to initialize and run the application. Option A (ejb-jar.xml) is for EJB modules, and the file must be specifically named web.xml.

Multiple choice technology
  1. True

  2. False

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

A single servlet instance typically handles multiple concurrent requests using a multi-threaded model. The container creates one instance (or a pool) and dispatches multiple threads to the service() method simultaneously. Each thread handles one request, allowing efficient resource utilization. Developers must ensure thread-safety in servlet code since instance variables are shared across threads.

Multiple choice technology
  1. True

  2. False

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

ServletContext provides an interface for servlets to interact with their runtime environment (the servlet container). Through ServletContext, servlets can access initialization parameters, container-wide resources, and share information with other servlets. It provides methods like getInitParameter(), getAttribute(), and log() to communicate with the container and application environment.

Multiple choice technology
  1. init()

  2. service()

  3. destroy()

  4. Above All

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

The servlet lifecycle consists of three main methods: init() (called once when servlet is initialized), service() (called for each request to handle business logic), and destroy() (called once before servlet is removed from service). All three are essential lifecycle methods, so Option D (Above All) is correct as it encompasses all of them. Option C only names destroy(), which is incomplete.

Multiple choice technology
  1. 2

  2. 1

  3. not fixed

  4. 3

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

There is exactly one ServletContext object per web application. It is created by the container when the application is deployed and shared by all servlets in that application. This singleton pattern ensures all servlets access the same application-wide configuration and attributes. The context is destroyed when the application is undeployed or the container shuts down.