Lately, as I wanted to get back into pure servlet programming, I wanted to double check where to get the right “Servlet API” from Maven. I was pretty surprised to see that they have moved.
Until version 3.0-alpha-1, servlet-api.jar was in javax.servlet/ servlet-api.jar and after, it is in javax.servlet/ javax.servlet-api.jar. As of February 2014, there is 3.0.1, a bunch of 3.1 betas and 3.1.0.
The version you want to use depends on your “servlet container” (kind of application server) support. As I am using Tomcat 7.0.50, it means I can (and will) pick 3.0.1. The following table was borrowed from the Apache Tomcat website.
Servlet Spec | JSP Spec | EL Spec | WebSocket Spec | Apache Tomcat version | Actual release revision | Minimum Java Version |
---|---|---|---|---|---|---|
3.1 | 2.3 | 3.0 | 1.0 | 8.0.x | 8.0.1 (beta) | 1.7 |
3.0 | 2.2 | 2.2 | 1.0 | 7.0.x | 7.0.50 | 1.6 (WebSocket 1.0 requires 1.7) |
2.5 | 2.1 | 2.1 | N/A | 6.0.x | 6.0.39 | 1.5 |
2.4 | 2.0 | N/A | N/A | 5.5.x (archived) | 5.5.36 (archived) | 1.4 |
2.3 | 1.2 | N/A | N/A | 4.1.x (archived) | 4.1.40 (archived) | 1.3 |
2.2 | 1.1 | N/A | N/A | 3.3.x (archived) | 3.3.2 (archived) | 1.1 |
More resources:
- Which version of Tomcat to use?