ChrisH
ChrisH

Reputation: 4826

Is there a generic version of servlet-api?

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?

Upvotes: 7

Views: 528

Answers (2)

DaveH
DaveH

Reputation: 7335

What is important is that you import and compile against the javax.servlet versions of these classes, rather than the vendor specific implementations of these interfaces.

Upvotes: 1

BalusC
BalusC

Reputation: 1108632

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:

Upvotes: 10

Related Questions