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
-
Asyncronous Java eXtensible Language
-
Asyncronous Java XML
-
Asyncronous JavaScript XML
-
Asyncronous J2EE XML
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'.
-
Embedding of Java code in HTML pages
-
Platform independence
-
Creation of database-driven Web applications
-
Server-side programming capabilities
-
jspInit(), _jspService() & jspDestroy()
-
init(), service(), destroy()
-
both 1&2
-
none
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.
-
View
-
Model
-
Controller
-
none
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).
-
Applets
-
Web Browsers
-
Wireless clients.
-
All the above
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.
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.
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.
-
ServletContext gives information about Container
-
ServletContext gives information about Request
-
ServletContext gives information about Session
-
none
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.
-
only request, response
-
only request, response & application
-
request, response, session & application
-
none
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.
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.
-
ejb-jar.xml
-
Can be any valid xml containing Web Module name
-
web.xml
-
config.xml
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.
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.
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.
-
init()
-
service()
-
destroy()
-
Above All
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.
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.