History of JSP & Java Web Development
Trace how JSP emerged alongside Servlets, and understand its place within Java EE and today's Jakarta EE.
Introduction
To really understand why JSP looks and behaves the way it does, it helps to know the history that produced it. JSP did not appear in isolation - it was Sun Microsystems' response to real limitations developers were hitting when building dynamic websites with pure Java in the mid-to-late 1990s.
The Early Web and CGI
In the early days of the web, dynamic pages were typically generated using CGI (Common Gateway Interface) scripts, often written in Perl or C. Each incoming request would start a brand new process on the server, run the script, and print raw HTML text to standard output. This worked, but it was slow (a new process per request is expensive) and messy (HTML was built by concatenating strings inside the script).
Servlets Arrive First
In 1997, Sun Microsystems introduced Java Servlets. A Servlet is a Java class that runs inside a server and handles HTTP requests directly, without starting a new process each time. This solved CGI's performance problem. But Servlets had their own drawback: to output HTML, developers had to write Java code that called out.println() for every single line of markup.
out.println("<html>");out.println("<body>");out.println("<h1>Welcome, " + userName + "</h1>");out.println("</body>");out.println("</html>");Mixing large blocks of HTML with println() calls made Servlet code hard to read, hard to maintain, and nearly impossible for a web designer without Java knowledge to touch.
JSP is Born
Sun released JavaServer Pages in 1999 to flip this model around. Instead of writing Java code that prints HTML, JSP let developers write HTML directly and drop in small pieces of Java only where dynamic content was needed. This was a huge readability win, especially for teams where designers handled the HTML/CSS and developers handled the logic.
Under the hood, JSP did not replace Servlets - it was built on top of them. When a JSP page is requested for the first time, the servlet container automatically translates it into a full Java Servlet class, compiles that class, and runs it. This means JSP and Servlets have always been two views of the same underlying technology: one optimized for writing markup, the other for writing logic.
Java EE and Jakarta EE
JSP became a core part of J2EE (later renamed Java EE - Java Platform, Enterprise Edition), the collection of specifications Sun (and later Oracle) maintained for building large-scale enterprise Java applications. Java EE bundled together JSP, Servlets, EJB, JDBC, and many other APIs under a single umbrella so that enterprise vendors like IBM, Oracle, and Tomcat/Apache could implement compatible servers.
In 2017, Oracle transferred Java EE to the Eclipse Foundation, and for licensing reasons the project was renamed Jakarta EE. JSP is now officially part of Jakarta EE, and its classes live under the jakarta.servlet.jsp package in the newest versions, whereas older applications still use the javax.servlet.jsp package. If you work on a legacy project, expect to see javax; if you work on a newly created one, expect jakarta.
| Year | Milestone |
|---|---|
| 1997 | Java Servlets released by Sun Microsystems |
| 1999 | JavaServer Pages (JSP) 1.0 released |
| 2000s | JSP becomes standard part of J2EE / Java EE enterprise stack |
| 2006 | JSTL (JSP Standard Tag Library) matures as the preferred way to write JSP logic |
| 2017 | Java EE transferred to Eclipse Foundation, later renamed Jakarta EE |
Version Timeline
JSP has evolved through several major versions, each adding capabilities while staying backward compatible with the core scriptlet/expression/directive syntax you saw in the previous lesson.
- JSP 1.0 / 1.1 - the original release, establishing scriptlets, expressions, and directives.
- JSP 1.2 - introduced JSTL support and stronger tag library integration.
- JSP 2.0 - added Expression Language (EL) as a built-in, first-class feature.
- JSP 2.1 - unified EL with JSF's expression language.
- JSP 2.2 / 2.3 - refinements alongside newer Servlet specification versions.
Common Mistakes
- Assuming JSP came before Servlets - Servlets (1997) predate JSP (1999) by two years.
- Thinking JSP replaced Servlets - JSP is built on top of Servlets, not a replacement for them.
- Mixing up javax.servlet and jakarta.servlet package names when reading code from different eras.
- Believing Java EE and Jakarta EE are unrelated projects - Jakarta EE is the continuation of Java EE under a new name and steward.
Best Practices
- When reading legacy code, check the import statements to quickly tell whether a project is on javax or jakarta.
- Understand that JSP and Servlets are meant to work together, not compete - use each for what it does best.
- Learn JSTL early, since it became the accepted best practice not long after JSP's early years.
- Treat the Java EE to Jakarta EE rename as a naming/licensing change, not a technical rewrite, when researching documentation.
Frequently Asked Questions
No. JSP is built on top of Servlets - every JSP page is translated into a Servlet by the container. They coexist and are typically used together.
They are the same project under different names. Oracle transferred Java EE to the Eclipse Foundation in 2017, which renamed it Jakarta EE for trademark reasons.
Older projects built before the Jakarta EE rename use the javax.servlet.jsp package. Newer projects use jakarta.servlet.jsp. Both work the same way conceptually.
JSP is newer. CGI predates both Servlets and JSP and was largely replaced by them because of CGI's poor performance under load.
Key Takeaways
- CGI scripting was slow because it started a new process per request.
- Servlets (1997) solved the performance problem but made writing HTML awkward.
- JSP (1999) solved the readability problem by letting HTML lead and Java support it.
- JSP has always been built on top of Servlets, not a replacement for them.
- Java EE was renamed Jakarta EE in 2017 after moving to the Eclipse Foundation.
Summary
JSP grew directly out of the limitations of CGI scripting and early Servlets, offering a more natural way to combine HTML and Java. It has remained part of Java's enterprise web stack ever since, first under Java EE and now under Jakarta EE. Next, you will look at why learning JSP is still a valuable skill today, especially for developers who work with legacy enterprise systems.