Is there a generic version of servlet-api?

I know that every servlet container (e.g. Tomcat, Glassfish, etc.) comes with a servlet-api implementation.

What I'm looking for is a universal (container agnostic) version of servlet-api for compiling my application code.

I would also like to use the source code or Javadoc for use in my IDE during development.

Is there such a version of servlet-api.jar?

+7
source share
2 answers

For a clean compilation, it does not matter which one you choose. You can extract it from the Tomcat /lib directory or take it from some Maven repo . Note that you select the correct version 2.3, 2.4, 2.5, or 3.0, which matches the target runtime, and that you never include it in webapp /WEB-INF/lib .

Since you are using an IDE (based on the history of the question, I put Eclipse), you can also simply link the dynamic web project to the target runtime. Thus, Eclipse will automatically enable the necessary libraries for compiletime.

See also:

+10
source

The important thing is that you import and compile against javax.servlet versions of these classes, and not vendor-specific implementations of these interfaces.

+1
source

All Articles