Learn servlet request handling with 26 Eclipse web projects. Compare RequestDispatcher.forward, include, sendRedirect, cookies, HttpSession, URL rewriting, listeners, JDBC, and file handling in small source folders.
Start here · Example catalog · Learning path · Contribute
Project format: these are historical Eclipse Dynamic Web Projects using javax.servlet, not a root Maven project. The current source tree contains no pom.xml; instructions to run mvn package at the repository root would be incorrect. Use a compatible JDK and a Java EE servlet container such as Tomcat 9.
| Question | Examples |
|---|---|
| How does forward differ from include or redirect? | Forward, Include, sendRedirect |
| How do servlet init parameters differ from context parameters? | ServletConfig, ServletContext |
| How do cookies and HttpSession track state? | Cookie tracking, HttpSession and cookies |
| Where are URL rewriting and hidden-field examples? | URL rewriting, Hidden form fields |
| What is the difference between request, session, and application scope? | Request, Session, Application |
| How do servlet listeners work? | SessionTracking-Listeners |
| Where is a servlet JDBC / layered application example? | DatabaseApp, Employee registration |
| Where can I inspect downloads, uploads, and thread safety? | ResourceDownloadApp, FileUploadApp, TestApp-ThreadSafety |
The full catalog links all 26 folders and their source roots.
git clone https://github.com/dibyapp/java-servlets-all-concepts.git- Install a compatible JDK, Tomcat 9, and Eclipse with Java web-development support.
- In Eclipse, use File → Import → Existing Projects into Workspace and select the
SendRedirection-SendRedirectfolder. Inspect the project's facets and classpath; configure your installed JDK and server runtime if the original machine-specific references are unresolved. - Add the project to a local Tomcat server and run it.
- Open the deployed context's
searchurlmapping with both required parameters, for examplehttp://localhost:8080/SendRedirection-SendRedirect/searchurl?query=java&engine=googlewhen that is your context name. - Inspect SearchServlet.java. The browser follows a redirect to the selected external search engine. This starter does not need an Oracle database.
An unknown server context causes a 404 even when Tomcat is running. Check the context name and servlet mapping before changing application code. The sample expects query and engine; a missing parameter can produce an error.
- Understand servlet mappings, request parameters, and response handling.
- Compare forward, include, and redirect. Some dispatching examples require a database; read their setup before running them.
- Compare cookies, sessions, URL rewriting, and hidden fields.
- Trace request/session/application attributes and listeners.
- Add JDBC and layered application examples using a disposable local database.
- Inspect file I/O and shared servlet state with security and concurrency in mind.
flowchart LR
A[HTTP request] --> B[Servlet mapping]
B --> C[Request handling]
C --> D[Response or redirect]
javax.servletsource is not automatically compatible with Tomcat 10+ /jakarta.servlet. A namespace and dependency migration is required.- Eclipse classpaths and file examples contain historical machine-specific settings. Replace them with your own runtime and disposable directories.
- JDBC examples need an Oracle driver, local connection details, and the schema expected by the example. Sample credentials in public code are not safe deployment credentials.
- Old bundled libraries and upload/download code need review before reuse. These are learning examples, not a secure file service or production authentication system.
- There is no claim that all 26 projects have been rebuilt or tested with current tools.
Consult Tomcat's migration documentation when moving from Java EE to Jakarta EE.
The inventory and documentation links were checked. Runtime execution remains unverified. See validation scope.
| What you want to understand | Repository |
|---|---|
| IoC, dependency injection, bean lifecycle, AOP | Spring Core examples |
| Controllers, JSP forms, validation, CRUD, PRG | Spring MVC examples |
| Requests, sessions, cookies, dispatching, JDBC | Java Servlet examples |
| Spring Boot 3.1 JPA/MySQL native-image demo | Spring Boot GraalVM demo |
| Explicit native Maven profile experiment | GraalVM application |
| Historical Boot 3.0 AOT/Kubernetes experiment | Spring native study project |
Found a broken example? Include its folder, Java/tool versions, a minimal reproduction, and a sanitized error. See CONTRIBUTING.md. A small fix with a repeatable before/after result is useful; unverified performance claims are not.
Maintained by dibyapp. MIT applies to the author's original contributions; inherited material and bundled third-party files retain their own terms. Read THIRD_PARTY_NOTICES.md. If an example helped you understand a concept, a star or a link to that specific example helps other learners find it.