• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet 3.0

 
Shan Rancho
Greenhorn
Posts: 2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I write a servlet [using servlet 3.0] without using web.xml in Tomcat 7? Is it possible to deploy a war without having a web.xml ?

Thanks
Shan
 
Ivan Jozsef Balazs
Rancher
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache Tomcat Versions


Servlet/JSPc Apache Tomcat version Actual release revision Minimum Java Version
3.0/2.2 7.0.x 7.0.34 1.6
2.5/2.1 6.0.x 6.0.36 1.5
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us what prompted this question? (I'm not sure how Ivan's answer is supposed to help.)
 
Ivan Jozsef Balazs
Rancher
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I'm not sure how Ivan's answer is supposed to help.


I gave the hint to the version data sheet about how the Tomcat version and the supported Servlet version match.
For example Apache Tomcat version 7.0 supports Servlet API 3.0.

I must admit to have tried Apache Tomcat version 7.0 so that the servlet was not declared in web.xml but was declared with annotations and it worked.
There was a web.xml however with welcome file and resource information, so I did not try this feature with a completely missing web.xml.
 
Shan Rancho
Greenhorn
Posts: 2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the new Servlet specification 3.0 and Java 5 (Annotation) introduction we can completely discard web.xml for particular servlet. My question/doubt is how container (Tomcat 7) resolve the servlet with annotations. Also can we deploy a WAR having one HelloworldServlet servlet without web.xml [using Tomcat Server 7.x]
 
gurunath pai
Greenhorn
Posts: 13
Android Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check this link for a glimpse of servlet 3.0 http://java.dzone.com/articles/checking-out-what-new-servlet
 
Ivan Jozsef Balazs
Rancher
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not that difficult to try it.

As said, I tried it and the servlet worked even though not declared in web.xml but only with the annotation.

What I have not tried yet it is whether a web application works without any web.xml at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic