62

Most of the places on the internet say it stands for WEB INFormation.

I rather doubt it. The folder contains executables. Information is not a suitable name for it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
euphoria83
  • 14,768
  • 17
  • 63
  • 73
  • META-INF/services/ essentially contains code, if in a rather minimalist, specialist language. – Tom Hawtin - tackline Mar 28 '09 at 16:09
  • Duplicate question which was asked in a much better way: http://stackoverflow.com/questions/19786142/what-is-web-inf-used-for-in-a-java-ee-web-application – BalusC Feb 18 '16 at 09:57

5 Answers5

49

As far as I know, "INF" stands for "Information", as you said. It probably was named WEB-INF for similarity with the META-INF directory in JAR files. Sometimes the meaning of a directory changes so much over time that it no longer makes sense. For example, bin directories in Unix/Linux often contain non-binary "executable" files, such as shell scripts.

Andy White
  • 86,444
  • 48
  • 176
  • 211
  • 3
    What's wrong with sticking with `META-INF` then? Why invent `WEB-INF` when `META-INF` already serves the needed purpose? – Pacerier Nov 17 '14 at 08:20
  • 1
    @Pacerier: Separation of concerns. `WEB-INF` is accessible as web resource. I.e. `ServletContext#getResource()/getResourceAsStream()` can access it as well as `ServletRequest#getRequestDispatcher()`. `META-INF` isn't accessible as web resource and shouldn't be. I.e. you shouldn't put web resources like JSP files there. – BalusC Jan 06 '20 at 20:31
18

I believe it's really named WEB-INF to mirror the META-INF directory in a jar file, which contains meta information. I do see what you mean about it being as much about executables as "information" but the main point is that it doesn't contain the documents of the application.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
11

It's a directory to store private application content. Anything your app needs but your client doesn't can be stored there. Anything in that directory is not visible to the web.

Source:

http://tomcat.apache.org/tomcat-7.0-doc/appdev/source.html#Directory_Structure http://docs.oracle.com/cd/E13222_01/wls/docs70/webapp/basics.html#136976

Churro
  • 4,166
  • 3
  • 25
  • 26
6

I think, the only logical definition is WEB-INF is mirror of META-INF. Naming is really important for beginners and if it is confusing then the subject is getting harder to understand.

3

The WEB_INF folder contains the web.xml (deployment descriptor) file, the classes, external libs etc and as web.xml file contains the information about the container urls, files etc, the folder is known as WEB-INF.

Mysticial
  • 464,885
  • 45
  • 335
  • 332
Rachit Mishra
  • 6,101
  • 4
  • 30
  • 51
  • This doesn't really answer the question of what `WEB-INF` actually stands for. – Kevin Workman May 27 '17 at 21:02
  • A better answer was added and accepted :) Quoting @andy-white `As far as I know, "INF" stands for "Information", as you said. It probably was named WEB-INF for similarity with the META-INF directory in JAR files.` – Rachit Mishra May 30 '17 at 06:49