I've noticed that my application doesn't have a web.xml file. I created a maven project as detailed here https://vaadin.com/docs/-/part/framework/tutorial.html but no web.xml is to be found anywhere. Do you guys know why and what I should do to add one in (as in is there a template somewhere and where does it go in my application?) thanks
Asked
Active
Viewed 1,615 times
0
-
I think the web.xml is not necessary as long as you put annotations in your code. – Steffen Harbich Jun 10 '16 at 06:21
-
Right thanks, I'm asking as somebody else told me it is actually necessary. Just out of interest, is there a template that is used for applications? And also, is that file automatically generated when you create certain applications or you create it only when and if you need annotations (by the way what kind of annotation, sorry really new to the whole thing!) – antobbo Jun 10 '16 at 07:33
-
Have a read on the topic, e.g. [here](http://stackoverflow.com/a/4538902/1063673) or [here](http://stackoverflow.com/a/30259601/1063673). [Templates](http://www.mkyong.com/web-development/the-web-xml-deployment-descriptor-examples/) for web.xml dependent on servlet version. – Steffen Harbich Jun 10 '16 at 07:50
1 Answers
2
Maven plugin doesnot create web.xml, I am always adding it manually to my projects.
just create web.xml
file in src\main\webapp\WEB-INF
folder with the below contents:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
</web-app>
Note: if you dont have WEB-INF
, create it as well.

Jalal Kiswani
- 738
- 5
- 11