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
-
ejbCreate()
-
ejbPassivate(),
-
ejbActivate()
-
All the above
D
Correct answer
Explanation
Session beans have callback methods that the container invokes at specific lifecycle points. ejbCreate() is called when a bean instance is created. ejbActivate() is called when a passivated bean is activated (moved from secondary storage to memory). ejbPassivate() is called when a stateful session bean is passivated (moved to secondary storage to conserve resources). All three are valid callback methods.
-
Java Transaction Service
-
Java Translation Service
-
Java Transaction Servlet
-
Java Translation Servlet
A
Correct answer
Explanation
JTS (Java Transaction Service) is the Java specification for transaction management. It defines the APIs and architecture for managing transactions across distributed systems in Java EE applications. The other options confuse 'Transaction' with 'Translation' or incorrectly identify it as a Servlet.
-
jspInit()
-
jspDestroy()
-
_jspService()
-
None of the above
C
Correct answer
Explanation
In JSP, the _jspService() method is automatically generated by the container and is responsible for handling HTTP requests. It receives HttpServletRequest and HttpServletResponse objects as parameters, similar to the service() method in servlets. jspInit() is for initialization (no parameters), jspDestroy() is for cleanup (no parameters). Therefore, _jspService() is the correct answer.
-
jspInit()
-
jspDestroy()
-
_jspService()
-
Both a & b
D
Correct answer
Explanation
JSP lifecycle allows overriding jspInit() for initialization and jspDestroy() for cleanup, but _jspService() is container-generated and cannot be overridden.
B
Correct answer
Explanation
WAR (Web Application Archive) files contain web applications ready for deployment on servlet/JSP containers like Tomcat or Jetty. They bundle HTML, JSP, JavaScript, classes, and configuration files.
-
Cookies
-
URL rewriting
-
HttpSession
-
All the above
D
Correct answer
Explanation
Session tracking can be implemented through multiple mechanisms: Cookies (stored on client), URL rewriting (appending session ID to URLs), and HttpSession (server-side session management). All three are valid approaches.
-
HttpRequest
-
XMLHttpRequest
-
JSON
-
XMLHttp
B
Correct answer
Explanation
The XMLHttpRequest object enables asynchronous communication with the server. It allows updating parts of a page without reloading by fetching data in the background.
-
responseText
-
onreadystatechange
-
oncompletion
-
readyState
D
Correct answer
Explanation
The readyState property indicates the current status of the XMLHttpRequest. It holds values from 0 (unsent) through 4 (completed), allowing scripts to track request progress.
-
GET
-
send
-
POST
-
getXMLHttpRequest
-
GET
-
send
-
POST
-
getXMLHttpRequest
B
Correct answer
Explanation
In the XMLHttpRequest API, the send() method is used to actually send the HTTP request to the server after it has been opened with open(). GET and POST are request methods passed to open(), not methods themselves. getXMLHttpRequest is not a standard method.
C
Correct answer
Explanation
JSP provides 9 implicit objects: request, response, out, session, application, config, pageContext, page, and exception. These are automatically available in JSP pages without explicit declaration.
-
jspInit()
-
jspservice()
-
jspDestroy()
-
All of the above
D
Correct answer
Explanation
JSP has three life cycle methods: jspInit() is called when the JSP is initialized, _jspService() handles each request (the option has a minor typo omitting the underscore), and jspDestroy() is called when the JSP is taken out of service. All three methods are part of the JSP life cycle.
-
<welcome><welcome-file>index.jsp</welcome-file></welcome>
-
<welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>
-
<welcome-files><welcome-file>index.jsp</welcome-file></welcome-files>
-
<welcome-files> <welcome>index.jsp</welcome></welcome-files>
B
Correct answer
Explanation
The correct XML syntax for welcome files in web.xml uses the element containing elements. This defines the list of files the server looks for when a user requests a directory URL (like '/').
-
By sending a mail to websphere_test team
-
By submitting a work request to WDT team
-
Either a or b
-
None of the above
B
Correct answer
Explanation
In corporate settings using IBM WebSphere, developers typically lack direct system administrative permissions to clear JVM logs on server instances. Submitting a work request to the WebSphere deployment/infrastructure team (WDT) is the correct process.
A
Correct answer
Explanation
Apache Struts is a classic open-source framework for developing Java EE web applications and is architecturally built upon the Model-View-Controller (MVC) design pattern.