Reputation: 3653
Java EE 7 documentation
https://docs.oracle.com/javaee/7/tutorial/packaging003.htm
suggest that web pages should be out side of WEB-INF
directory while most of times we see them in places like root/WEB-INF/view
or root/WEB-INF/jsp
etc.
Could any body describe which strategy should be followed and which not?
Upvotes: 1
Views: 135
Reputation: 439
I recommend pages to be stored under WEB-INF.
If they're outside you may open a security hole. The web container protects WEB-INF so your users will not be able to access the contents unless your application directs them there. This is aligned with what most web (java) frameworks do when they resolve views and generate the actual web contents.
Storing plain view files outside WEB-INF may work (for example if you serve plain html or old school JSP files) but it may alleviate some processing that your web layer does.
Best to keep the view files (not just pages!) inside WEB-INF and have the web framework (JSF, Spring MVC, Struts, ...) deal with them.
Upvotes: 3