views:

1072

answers:

3

Hi, I'm stepping into the world of Servlets and 3.0 in particular and I saw certain methods and annotations used in examples and tutorials which talked about this being available when JAVA 6.0 is released (which it has) and now when I try to use the above annotation for example in Eclipse it does not recognize it although I have java 1.6.013 installed and in Eclipse it says I'm using jre6. When I tried googling it a bit I stumbled on this page regarding WebServlet Annotation where it states on the top right side: DRAFT. what does that mean? Is @WebServlet supported in 1.6.013 or not? is the problem with my Eclipse?

Thanks a lot for anyone who can lend me a helping hand

EDIT: I now understand I've made a bit of a mess but there is a Jar I've downloaded of the Servlets 3.0 API which at least for the @WebServlet annotation works but gives me hell.

+3  A: 

Servlets are defined by a JSR - the Servlet Specification in JSR-154. Annotations for servlets were introduced in version 2.5 of the servlet specification. All containers that implement the 2.5 version of the specification will support annotations; your problem might lie with the container not implementing it. You can refer section SRV.14.5. Annotations and Resource Injection of the servlet spec where it is defined in black and white.

By the way, you are looking at the javadocs of Java EE 6 (which is in draft at the moment). Servlet Spec 2.5 is part of Java EE 5.

PS: The @WebServlet annotation that you are referring to, makes its appearance in Servlet Spec 3.0, which is in draft, and is a part of Java EE 6. At the time of writing this, no container is available for download that supports Servlet Spec 3.0; not even a RI (reference implementation) is available. You will find experimental builds though, but be forewarned, the spec itself is not final, so experimental builds are bound to interpet and implement the spec differently.

PPS: Glassfish v3 Preclude Preview seems to have support for most of the Java EE 6 standards. A comparison sheet provides info on what is available in Glassfish v2, v3 Preclude and v3 Preview.

Vineet Reynolds
thanks a lot for your answer, do you happen to know where I can find a timeTable for Java EE 6? I understand it's in draft but the functionality I need is in Servlets 3.0 (JSR-00315)
Ittai
Unfortunately, there can be a very long period of time between a public draft and the final release with several changes made in between. You can only keep your fingers crossed.
Vineet Reynolds
You can try out the Servlet 3 support in Glassfish as pointed out by Pascal. An introductory article is available at http://blog.arungupta.me/2009/05/totd-82-getting-started-with-servlet-3-0-and-ejb-3-1-in-java-ee-6-using-netbeans-6-7/
Vineet Reynolds
The reason why should stick to JEE5 and Servlet 2.5 for now (as Will pointed out) is because of the Glassfish v3's schedule. It is available at http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3Schedule. It does not talk of JEE6 support being a blocker. So there is a tendency for it to become like Oracle OC4J 10.1.3.x which had a bit of JEE 5 features, but was never a JEE 5 container - not even one bit amusing for customers who want a JEE 5 stack.
Vineet Reynolds
Thanks a lot! the Glassfish v3 Preview is what I need and the comparison sheet really helped me. If I had more rep points I'd give you a vote up so +1 for now :)
Ittai
+1  A: 

Following up on Vineet, simply put, 3.0 isn't in use right now, so you should focus on JEE 5 and 2.5.

Will Hartung
+2  A: 

At this time, GlassFish v3 provides the most complete implementation of EJB 3.1 and Servlet 3.0 along with other Java EE 6 specifications.

Pascal Thivent