Hi everybody.
I started using java for web apps a few months ago and i still have much to learn. I have one simple question to which i found no answer on the internet.
We all know the directory structure of a webapp
/
/WEB-INF
/WEB-INF/lib
/WEB-INF/classes
Files in the root directory are available via HTTP to the end user. But it would be such a mess to put DOZENS of images and other stuff just in one directory!
Isn't there a way to tell the servlet container to have more public dirs? Besides, many javascript applications (like TinyMCE editor) have their own directory structure and many .js files would end not being in a public folder.
Any suggestions?
Thank you in advance.
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
You can create directories in the root directory as you please: /images, /css, /js, ... They will all be publicly accessible.
Martin Bechtle
Greenhorn
Joined: Nov 17, 2011
Posts: 3
posted
0
Oh, excellent!
And what about making them inaccessible for end user? What's the best practice? CHMOD them, configure some XML on the server or placing them in WEB-INF/...?
Any resource you do not want to be directly accessible via URL (JSPs for example, which should only be accessed via their page controllers) can be placed under WEB-INF.