Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
Servlets are server-side Java components that handle requests and generate responses, typically over HTTP. They run inside a servlet container such as Tomcat or a Java EE application server.
Given Data / Assumptions:
Concept / Approach:
Servlets implement doGet/doPost and related methods, reading request parameters and writing to the response stream. They are the foundation for higher-level frameworks (JSP, JSF, Spring MVC).
Step-by-Step Solution:
Client issues HTTP request to a URL mapped to a servlet.Container constructs HttpServletRequest/Response objects.Servlet method executes server-side logic (I/O, DB calls).Servlet writes response; container returns it to client.Lifecycle methods init/destroy manage resources.
Verification / Alternative check:
Inspect server logs or add logging to confirm server-side execution.
Why Other Options Are Wrong:
Servlets are not client-side; SOAP is unrelated to whether HTTP invokes the servlet.
Common Pitfalls:
Assuming servlets run in the browser; confusing servlet with applet.
Final Answer:
Correct
Discussion & Comments