简体   繁体   English

webapp / WEB-INF或src / main / resources下的资源文件?

[英]resource files under webapp/WEB-INF or src/main/resources?

In my project i see some xmls under src/main/webapp/WEB-INF while some under src/main/resources . 在我的项目中,我在src/main/webapp/WEB-INF下看到一些xml,而在src/main/resources下看到一些。 Is there any convention what kind of file should go under these location 有没有约定在这些位置下应该放哪种文件

src/main/resources contains Application/Library resources. src / main / resources包含应用程序/库资源。

The Servlet 2.4 specification says this about WEB-INF: Servlet 2.4规范说明了有关WEB-INF的信息:

A special directory exists within the application hierarchy named WEB-INF. 在应用程序层次结构中存在一个特殊目录,名为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. WEB-INF节点不是应用程序的公共文档树的一部分。 No file contained in the WEB-INF directory may be served directly to a client by the container. 容器不能将WEB-INF目录中包含的文件直接提供给客户端。 However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext, and may be exposed using the RequestDispatcher calls. 但是,使用ServletContext上的getResource和getResourceAsStream方法调用,Servlet代码可以看到WEB-INF目录的内容,并且可以使用RequestDispatcher调用公开WEB-INF目录的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 src / main / resources下的哪些文件以及WEB-INF下的文件? - which files under src/main/resources and files under WEB-INF? src / main / resources下的文件位于target / WEB-INF / classes下 - Files under src/main/resources goes under target/WEB-INF/classes 无法从控制器中的src/main/webapp/WEB-INF/resources/img访问图像文件以在jsp中显示 - Can't access image file from src/main/webapp/WEB-INF/resources/img in controller to display in jsp java.io.FileNotFoundException:类路径资源[src / main / webapp / WEB-INF / spring / appServlet / servlet-context.xml] - java.io.FileNotFoundException: class path resource [src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml] Tomcat Servlet:src / main / webapp / WEB-INF时为404状态,而root / WEB-INF时为无错误 - Tomcat Servlet: 404 status when src/main/webapp/WEB-INF and no error when root/WEB-INF 如何告诉 maven 插件我的 JSP 位于 `/src/main/webapp/WEB-INF/jsp` 而不是 `src/main/scripts`? - How can I tell maven plugin that my JSPs live in `/src/main/webapp/WEB-INF/jsp` and not `src/main/scripts`? applicationContext.xml从src / main / resources复制到/ WEB-INF / classes - applicationContext.xml is being copied to /WEB-INF/classes from src/main/resources 在`WEB-INF / lib`文件夹中找不到jar文件的解决方案,也没有在`src / main / resources`文件夹中找到? - Solution for a jar file not findable in the `WEB-INF/lib` folder nor `src/main/resources` folder? Maven将applicationContext.xml从src / main / resources复制到target / myproject / WEB-INF - Maven copying applicationContext.xml from src/main/resources to target/myproject/WEB-INF Java WebApp:从位于WEB-INF的.jar加载资源 - Java WebApp: Loading resource from .jar located in WEB-INF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM