Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a generic version of servlet-api?

Tags:

java

servlets

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?

like image 767
ChrisH Avatar asked May 10 '11 15:05

ChrisH


1 Answers

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.

See also:

  • How do I import the javax.servlet API in my Eclipse project?
like image 62
BalusC Avatar answered Sep 19 '22 23:09

BalusC