Taking Maven as an example, when started a new web project, the structure is the same / similar to this:
Meu Projeto
|- src
|- main
|- java
|- resources
|- webapp
|- WEB-INF
Where, in the "webapp" directory are placed the files used by the web application: html, css, Javascript, JSPs, etc.
My question is in relation to the WEB-INF directory, there are several projects that use this directory to put files with .jsp extension, instead of placing them directly in "webapp". An example is Caelum's Mammoth , where they created a directory called "jsps" for this.
As I read about it, the files contained in WEB-INF can not be accessed directly by the client because they are not public, but can be accessed by servlets:
A special directory exists within the hierarchy named WEB-INF. This directory contains all things related to the application that is not in the root document 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 the servlet code using the
getResource
andgetResourceAsStream
method calls on theServletContext
, and may be exposed using theRequestDispatcher
calls .
So it would only be for safety? The only way to get the files would be when being processed through a servlet.