While coding a servlet I found a method that says
Since:
Servlet 3.1
I guess that if I have the autohint from NetBeans to use it is bec
Look at Java EE version. Servlet (and JSP, JSF, EJB, JPA, etc) version goes hand in hand with Java EE version.
Look at the server homepage/documentation how it presents itself. For GlassFish, that is currently (with 4.1):
World's first Java EE 7 Application Server
So, it's Servlet 3.1.
But, with a big but, that's one thing. The second thing is, the webapp's web.xml
version also plays a role. Not everyone knows that.
If your webapp's web.xml
is declared conform Servlet 3.1 like below,
then your webapp will also really run in Servlet 3.1 modus.
However, if it's declared conform Servlet 3.0 like below or even older,
then your webapp will run in Servlet 3.0 compatibility modus, even when deployed to a Servlet 3.1 compatible container! The above influences the ServletContext#getMajorVersion()
and getMinorVersion()
, so they actually say nothing about the container, but only about the webapp itself.
If your webapp's web.xml
contains a , regardless of the DTD and the version, then it will run in Servlet 2.3 compatibility modus, even when there's a newer XSD declared!