eclipse - 404 - 在 eclipse 中找不到子目录下的资源

标签 eclipse tomcat

只有当它直接位于 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/

相关文章:

java - 启动tomcat7 :run maven plugin within eclipse and debug

java - IndexOutOfBoundsException : Index: 0, 大小:0 2D Arraylist

eclipse - 在 Eclipse 中使用 SonarQube

linux - SSL : HTTP to HTTPS conversion error

java - Eclipse 文件没有出现在提交中

c++ - 无法在 Eclipse 中作为 C++ 项目运行

java - 在tomcat中部署

spring - 现有的 Spring 应用程序到 Cloud Foundry

java - Spring Security 教程不适用于 Tomcat 服务器

mysql - AWS Linux 使用tomcat7 配置mysql