Qus:    How do I know which version of a servlet I'm using on Java?
Apr 20, 2021 11:25 1 Answers Views: 65 SHIVA
Prev Next
Answers (1)
DIVYA Apr 21, 2021 08:43
Answer:   If I recall correctly, servlet API versions are backwards compatible, so it shouldn’t matter.
There’s not really a better way to do this other than finding the differences in class structure and testing via reflection. This would be an extremely bad idea, btw. You should be targeting an API in most cases, rather than an implementation.
Please note that this is a bit confusing in earlier API releases because Java originally created specifications and expected Java EE partners to create implementations of the API. This meant that several of the early releases of Java EE have slight differences that were platform specific. For example, Jboss and Webmethods platforms had an extra method here or there in their implementations of the API to help them do something custom. That was remedied in later versions of Java and its respective APIs by making the APIs part of the Java codebase and only leaving implementations to the platforms.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect