Could someone explain the main differences (or provide a link to) between glassfish-web.xml
, sun-web.xml
and web.xml
?
Can I use just glassfish-web.xml
in my webapp and skip the others?
You may or may not need a web.xml file. It depends on the Java EE features you use. By default, don't use any of these files and simply use Java EE annotations like @WebServlet. As you build out your app and perhaps begin using some features that require the web.xml file (like to define the JavaServer Faces FacesServlet), then use a web.xml file. As for the glassfish-web.xml, you only use one if you have GlassFish-specific features to configure for your application.
The Java EE tutorial is also a good way to learn Java EE, and is bundled with the Java EE 7 SDK along with GlassFish 4.