[go: up one dir, main page]

0% found this document useful (0 votes)
16 views2 pages

Java EE Theory Study Notes

The document outlines the lifecycle of a Servlet, detailing the init(), service(), and destroy() methods. It distinguishes between JSP and Servlets, highlighting their syntax, compilation, and use cases. Additionally, it covers the use of RequestDispatcher, differences between GET and POST HTTP methods, the role of web.xml in Java EE, and preparation for identifying components and flows in images.

Uploaded by

Rhoda Ansah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Java EE Theory Study Notes

The document outlines the lifecycle of a Servlet, detailing the init(), service(), and destroy() methods. It distinguishes between JSP and Servlets, highlighting their syntax, compilation, and use cases. Additionally, it covers the use of RequestDispatcher, differences between GET and POST HTTP methods, the role of web.xml in Java EE, and preparation for identifying components and flows in images.

Uploaded by

Rhoda Ansah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Section A – Theory (30 marks): Study

Notes
1. Lifecycle of a Servlet

- init(): Called once when the servlet is first loaded. Used for one-time setup.
- service(): Called every time a request is made. Processes GET, POST, etc.
- destroy(): Called when the servlet is being removed. Used for cleanup.

2. Distinguish between JSP and Servlets


Feature JSP Servlet

Syntax HTML with Java code Pure Java code

Compilation Compiled to Servlet at Compiled directly as Java


runtime class

Use Case Presentation layer (views) Business logic / controller

3. Use of RequestDispatcher

- forward(request, response): Transfers control to another resource on the server. Client is


unaware.
- include(request, response): Includes content of another resource in the current response.

4. JSP Directive Explanation


<%@ page import="java.sql.*" %>

- Purpose: Imports Java SQL classes (like Connection, Statement, etc.) for use in JSP.
- Directive: page directive with import attribute.
5. GET vs POST HTTP Methods
Feature GET POST

Data in URL Yes (query string) No (sent in request body)

Use case Fetching data (e.g., search Submitting data (e.g.,


queries) forms)

Security Less secure (data in URL) More secure

6. Role of web.xml in Java EE

- Deployment descriptor in WEB-INF/.


- Defines:
- Servlet mappings
- Welcome pages
- Error pages
- Context parameters

7. Image Identification Question

- Be ready to:
- Identify components like actors, classes, or processes.
- Describe flows: control flow, data flow, or interactions.

You might also like