I know that each servlet container (e.g. Tomcat, Glassfish, etc.) comes with an implementation of servlet-api.
What I am looking for is a generic (container agnostic) version of servlet-api to compile my application code against.
I would also like source code or Javadoc to use in my IDE during development.
Does such a version of servlet-api.jar exist?
For pure compilation, it doesn't matter which one you picks. You could extract it from Tomcat's /lib
directory or grab it from some Maven repo. Please pay attention that you pick the correct version, 2.3, 2.4, 2.5 or 3.0 which is the same as the target runtime and that you never include it in webapp's /WEB-INF/lib
.
Since you're using an IDE (based on your question history, I'll bet Eclipse), you could also just associate the dynamic web project with a target runtime. This way Eclipse will automagically include the necessary libs for compiletime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With