Search code examples
jakarta-eeweb.xmlspecifications

Java EE - searching for web.xml general specification


I'm a Java EE newbie. I found out that web.xml is a standard file (deployment descriptor) used by many servlet containers/application servers like tomcat, glassfish, etc. In many tutorials I can find various XML tags that I should put custom values somewhere to achieve a given functionality (in the context of a tutorial). But it's quite chaotic - I don't know if I can reuse a tag inside spring/tomcat that was originally used in glassfish/jsf (it's just an example problem). Is there one major Java EE specification for web.xml so that I would know what tags can I put there, independently on web servers and frameworks used?

I read that e.g. tomcat has some specific options provided for web.xml file, so I guess each server would behave a little bit differently (just like web browsers can interpret HTML/CSS differently) - but is there a major documentation somewhere (independently on the framework)?


Solution

  • Usually in the java world the general specification called JSR. For example the Servlet specification contains the definition of web.xml (and how to interpret it). There are multiple Servlet version, and they specified by different JSR-s. For example the Servlet 2.4 specification can be found here: http://jcp.org/en/jsr/detail?id=154 (it is called JSR-154)

    I think the specification does not allow different vendors to use different web.xml-s. Instead of that they advise to use an other file with the web.xml. Because the Tomcat used to be the reference implementation of Servlets (but not any more) I think tomcat is very strict with the JSR.

    Right now the latest servlet specification is 3.0 (3.1 is coming soon)