Reputation: 959
I'm developing my first web application with JBoss with Eclipse Luna and Windfly as server. Looking in the WEB-INF i cannot find the web.xml file. It is all ok, the application works, but where are the web.xml settings located? How can i change, for example, the class-URL associations? Please note that i can't see any annotation inside the classes i've coded.
Upvotes: 1
Views: 2481
Reputation: 3500
Starting from java ee 6, web.xml is no longer required for a web app to deploy. Instead of using xml, you can use annotations to replace the xml file.
Here you can find the correspondence between annotations and old web.xml elements
https://blogs.oracle.com/swchan/entry/servlet_3_0_annotations
For example, class and url assocations are resolved using @WebServlet
@WebServlet(name="testServlet", urlPatterns={"/hello"})
Upvotes: 4
Reputation: 1555
When you create Dynamic Web Project with Eclipse you can choose Dynamic Web Project module. To create project with deployment descriptor web.xml you must choose 2.5 version. Because 3.0 version uses annotations not xml configuration. To generate web.xml
right click on your project -> Java EE Tools -> Generate deployment descriptor.
To use only web.xml you must change version of your Dynamic Web Project module to 2.5 go to .settings directory in your project folder and change jstl.web param to 2.5 in file org.eclipse.wst.common.project.facet.core.xml
To check the changes was made go to
Project Properties-> Project Facets and find Dynamic Web Module line.
Upvotes: 1