Java Server Tutorials

These tutorials assume you're already familiar with the fundamentals of coding, and that you've already read the Java tutorials. You should also be familiar with client-side web programming from the HTML and JavaScript tutorials.

Running a Server

Pick a server and run with it.

Not sure which to choose? Try each one out and see which one you like the best!

Javax vs Jakarta

Java EE has a long and complicated history which can make tutorials and examples confusing. I'll try to simplify it as much as possible so you know what you're looking at.

Java EE stands for Java Enterprise Edition. "Enterprise" means "business", because back when it was invented in 1999, the only websites that needed server code were owned by businesses. Since then, server code has been used by many people, not just businesses, but the name stuck.

From 1999 to 2019, Java EE was continually developed by Sun and then Oracle. They launched several versions of Java EE, which included several versions of the Java servlets API. They released their code under the javax package, for example the javax.servlet.http.HttpServlet class.

Then in 2019, Oracle gave Java EE to the Eclipse Foundation. But here's the weird part: they didn't let the Eclipse Foundation use the name "Java" or the javax package.

That meant that after 2019, Java EE was renamed to Jakarta EE, and the code itself was moved to a new jakarta package, for example jakarta.servlet.http.HttpServlet.

In other words, old tutorials will talk about Java EE and use the old javax package, but new tutorials will talk about Jakarta EE and use the new jakarta package. This also means that if you download an old version of a library or server container, it might only work with the old javaxpackage, but new versions of libraries and server containers will only work with the new jakarta package.

This is all really confusing, so if you have a question, please reach out to me on the Happy Coding forum)!

Java Server Tutorials

After you've run a server, read through these tutorials in order.

Chapter 1: Anatomy of a Web App


Anatomy of a Web App Examples


Chapter 2: Client / Server Communication


Chapter 3: Servlets


Servlets Examples


Chapter 4: JSP


JSP Examples


Chapter 5: Eclipse EE


Chapter 6: Post Requests


Post Requests Examples


Chapter 7: Libraries


Chapter 8: Sanitizing User Input


Sanitizing User Input Examples


Chapter 9: Sessions


Sessions Examples


Chapter 10: Secure Password Storage


Chapter 11: Thread Safety


Thread Safety Examples


Chapter 12: Hosting on AWS


Chapter 13: Hosting on Google App Engine


Chapter 14: Databases


Chapter 15: Uploading Files


Chapter 16: Creating a REST API


Chapter 17: Struts