只有当它直接位于 eclipse 中的 WebContent 下时,我才能访问资源(比如 test.html)。如果我将它放在 WEB-INF 或 WEB-INF/jsp 中,IDE 会显示错误 404-requested resource is not可用。
http://localhost:8080/MyApp/test.html (This works when test.html is under WebContent and not any of it's subdirectory)
当它在 WebContent/WEB-INF 中时 右键单击运行转到以下 URL,该 URL 显示 404-资源不可用
http://localhost:8080/MyApp/WEB-INF/test.html
如何通过在 WEB-INF 或 WEB-INF/jsp 中放置“test.html”来访问它?
所有配置都是默认的,在web.xml中没有指定限制,使用Tomcat 7作为web服务器
最佳答案
防止访问特定文件。您无法从服务器本身外部访问/WEB-INF/目录。如果要创建子目录,请在
网络应用程序/ -index.jsp -你的子目录/ --测试.jsp
test.jsp可以通过localhost:8080/MyApp/YourSubdirectory/test.jsp访问
关于eclipse - 404 - 在 eclipse 中找不到子目录下的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16557778/