Learning Vaadin 7 Nicolas Fränkel (web.xml yes or not)

I am reading the new book of Nicolas Fränkel ‘Learning Vaadin 7’ second Edition.
At the beginning it’s recommend declare :

<servlet-name My First Vaadin Application</servlet-name>
<servlet-name My First Vaadin Application</servlet-name>

If i make a project with eclipse or with maven there is no more web.xml in the project.
I am confusing now.
Is it necessary to have a web.xml?


In Vaadin 7.1, i think it was, servlet configuration annotations for the UI class were introduced. These can replace the web.xml completely.
I personally still prefer using the web.xml (you can change an existing project just by removing the annotations and adding a web.xml in the src/main/webapp/WEB-INF/ folder containing all necessary mappings) because i ran into quite a lot of problems when using the annotations. (Sometimes the app just wasn’t reachable while the server was when i ran tomcat:run).

So it’s your choice. You can try using the annotations but if they don’t work for you or you don’t “like” them you can still change to the “old way”.

Servlet 3.0 annotations have always been usable on Servlet 3.0 compatible application servers as an alternative, but Vaadin 7.1 introduced a new annotation of its own that makes configuring such servlets considerably easier.

You can have both servlet 3.0 annotations and a web.xml, in which case your web.xml overrides the annotations. This enables e.g. the person responsible for deploying your application to reconfigure the application for production.

I personally prefer servlet 3.0 annotations but both methods are fine.