Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
404-在eclipse中找不到子目录下的资源_Eclipse_Tomcat - Fatal编程技术网

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

404-在eclipse中找不到子目录下的资源,eclipse,tomcat,Eclipse,Tomcat,我只能在eclipse中直接在WebContent下访问资源(比如test.html)。如果我将其放在WEB-INF或WEB-INF/jsp中,IDE显示错误404请求的资源不可用 http://localhost:8080/MyApp/test.html (This works when test.html is under WebContent and not any of it's subdirectory) 当它位于WebContent/WEB-INF中时 右键单击run转到下面的U

我只能在eclipse中直接在WebContent下访问资源(比如test.html)。如果我将其放在WEB-INF或WEB-INF/jsp中,IDE显示错误404请求的资源不可用

 http://localhost:8080/MyApp/test.html (This works when test.html is under WebContent and not any of it's subdirectory)
当它位于WebContent/WEB-INF中时 右键单击run转到下面的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目录中的文件。这是基本的限制

但是,可以在应用程序级别访问此目录的内容。Web容器提供了这样的机会


例如,如果您使用SpringMVC,您可以将一些URL映射到WIB-INF目录下的文件,它将正常工作。

以防止访问特定文件。无法从服务器本身外部访问/WEB-INF/目录。如果要创建子目录,请在下创建它们

网络应用/ -index.jsp -你的子目录/ --test.jsp

可以通过localhost:8080/MyApp/YourSubdirectory/test.jsp访问test.jsp