Moving resources under WEB-INF

What is the easiest method for me to safely move all html/js/images folders under the WEB-INF without breaking all links/forwarding to resources in these folders and make sure these resources are not directly accessible? You’re making a thiniking mistake here. HTML/JS/image (and CSS) resources need to be directly accessible anyway. For JSPs the story is … Read more

JSF files inside WEB-INF directory, how do I access them?

I want to put my JSF 2.0 xhtml files under WEB-INF\jsf. How do I access them then? You cannot. Files in /WEB-INF folder are not directly accessible. There are two options to workaround the problem of JSF source files being public accessible. Map the FacesServlet on *.xhtml instead of *.jsf. Or, restrict direct access on … Read more

Which XHTML files do I need to put in /WEB-INF and which not?

Files in /WEB-INF folder are indeed not publicly accessible by enduser. So you cannot have something like http://localhost:8080/contextname/WEB-INF/some.xhtml. That would be a potential security hole as the enduser would be able to view among others /WEB-INF/web.xml and so on. You can however use the /WEB-INF folder to put master template files, include files and tag … Read more

What is WEB-INF used for in a Java EE web application?

The Servlet 2.4 specification says this about WEB-INF (page 70): 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 … Read more

JSP in /WEB-INF returns “HTTP Status 404 The requested resource is not available”

404 simply means “Not Found”. Either the URL is wrong (note: case sensitive!), or the resource is not there where you think it is. Just verify the URL and/or verify if the resource is there where you’d expect it to be. You placed sample.jsp in /WEB-INF folder. This way it is not publicly accessible without … Read more