6
Taking Maven as an example, when starting a new web project, the structure is equal/similar to this:
Meu Projeto
|- src
|- main
|- java
|- resources
|- webapp
|- WEB-INF
Where, in the directory "webapp" are placed the files used by the web application: html, css, Javascript, Jsps, etc.
My question is regarding the WEB-INF directory, there are several projects that use this directory to put the files with extension . jsp, instead of putting them directly into "webapp". An example is Mammoth from Caelum, where they created a directory called "jsps" for this.
From what I read about it, the files contained in WEB-INF cannot be accessed directly by the client because they are not public, but can be accessed by Servlets:
A special directory exists Within the application Hierarchy named WEB-INF. This directory contains all Things Related to the application that aren’t in the Document root of the application. The WEB-INF Node is not part of the public Document Tree of the application. No file contained in the WEB-INF directory may be served directly to a client by the container. However, the Contents of the WEB-INF directory are Visible to Servlet code using the
getResourceandgetResourceAsStreammethod calls on theServletContext, and may be Exposed using theRequestDispatchercalls.
So it would only be for security? The only way to get the files would be to be processed through a Servlet.