What does WEB-INF stand for in a Java EE web application? [closed]
Asked Answered
C

5

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.

Circuit answered 28/3, 2009 at 15:49 Comment(2)
META-INF/services/ essentially contains code, if in a rather minimalist, specialist language.Insolent
Duplicate question which was asked in a much better way: #19786642Gaffrigged
B
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.

Brigand answered 28/3, 2009 at 16:2 Comment(2)
What's wrong with sticking with META-INF then? Why invent WEB-INF when META-INF already serves the needed purpose?Chesna
@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.Gaffrigged
S
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.

Saiva answered 28/3, 2009 at 16:2 Comment(3)
@jon skeet : change the tags if you wishCircuit
Looks like it's been done - will edit the answer now so it still makes sense :)Saiva
(Is there now any point in having this answer as well as Andy White's? I'm tempted to delete.)Saiva
P
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

Paintbrush answered 2/7, 2013 at 23:53 Comment(1)
This doesn't really answer the question of what WEB-INF actually stands for.Eldwon
P
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.

Philibeg answered 21/10, 2009 at 13:18 Comment(0)
Z
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.

Zeist answered 18/9, 2012 at 11:3 Comment(2)
This doesn't really answer the question of what WEB-INF actually stands for.Eldwon
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.Zeist

© 2022 - 2024 — McMap. All rights reserved.