views:

21

answers:

1

Hi,

Could someone please explain the purpose of this option and what exactly it is for.

It looks like the default is on my eclipse installation is 3.0 but it wont run on a Tomcat 5.5 server and probably not Tomcat 6.0 Is it related to the servlet spec that the Tomcat server supports? If so which version do i need to use for Tomcat 5.5 and Tomcat 6.0?

And also, i think there is a link between the compiler version that i use and the web module version selected. Is there some kind of documentation that explains what this relationship is?

Edit

And also, why is it that if i select v2.4 web module, it defaults to JDK 1.4?

Thanks

+1  A: 

That version correlates with Servlet API version. Servlet 3.0 (released at december 2009 as part of Java EE 6) runs on Servlet 3.0 containers only (Tomcat 7, Glassfish 3, JBoss AS 6, etc). Servlet 2.5 (released at 11 may 2006 as part of Java EE 5) runs on Servlet 2.5 containers only or newer (Tomcat 6, Glassfish 2, JBoss AS 5, etc). Servlet 2.4 (released at november 2003 as part of J2EE 1.4) runs on Servlet 2.4 containers only or newer, etcetera.

You just need to pick the right API version whatever you want to implement your webapp in. Or if you don't have the freedom in picking the servlet container used, then pick the API which suits the servlet container version the best.

As to why the JDK defaults to one or other, it's just the minimum JDK requirement of the Servlet API version in question. Often, when you're picking an older Servlet API, in reality the JRE/JDK used is also that old.

BalusC
Ok yes that makes sense. Funnilly enough we are using Tomcat 5.5 with JDK6 which means servlet 2.4 but the 1.6 compiler. This means i have to change the compiler setting everytime. I could set it as the default setting but that would not match other unrelated projects.
ziggy