Skip to content

About

Java Servlet tutorial with 26 Eclipse web projects: RequestDispatcher, redirects, sessions, cookies, JDBC, listeners, and file handling. javax.servlet examples with Tomcat 9 setup notes.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Servlet Tutorial: Requests, Sessions, Cookies, and JDBC Examples

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.

Find the concept you need

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.

Start here

git clone https://github.com/dibyapp/java-servlets-all-concepts.git
  1. Install a compatible JDK, Tomcat 9, and Eclipse with Java web-development support.
  2. In Eclipse, use File → Import → Existing Projects into Workspace and select the SendRedirection-SendRedirect folder. Inspect the project's facets and classpath; configure your installed JDK and server runtime if the original machine-specific references are unresolved.
  3. Add the project to a local Tomcat server and run it.
  4. Open the deployed context's searchurl mapping with both required parameters, for example http://localhost:8080/SendRedirection-SendRedirect/searchurl?query=java&engine=google when that is your context name.
  5. 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.

Learning path

  1. Understand servlet mappings, request parameters, and response handling.
  2. Compare forward, include, and redirect. Some dispatching examples require a database; read their setup before running them.
  3. Compare cookies, sessions, URL rewriting, and hidden fields.
  4. Trace request/session/application attributes and listeners.
  5. Add JDBC and layered application examples using a disposable local database.
  6. 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]
Loading

Compatibility and limits

  • javax.servlet source 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.

What has been checked?

The inventory and documentation links were checked. Runtime execution remains unverified. See validation scope.

Continue learning

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

Contribute or report a problem

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.

About

Java Servlet tutorial with 26 Eclipse web projects: RequestDispatcher, redirects, sessions, cookies, JDBC, listeners, and file handling. javax.servlet examples with Tomcat 9 setup notes.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages