简体   繁体   English

如何将WebContent文件夹部署到tomcat?

[英]How to deploy a WebContent folder to tomcat?

I have a simple project in eclipse that only contains a WebContent folder with dynamic html pages (javascript, jquery, css etc). 我在Eclipse中有一个简单的项目,其中仅包含带有动态html页面(javascript,jquery,css等)的WebContent文件夹。

How can I deploy such a project (that does not have a war file) to a Tomcat ? 如何将这样的项目(没有war文件)部署到Tomcat

A WAR file is just a .zip with a different extension. WAR文件只是具有不同扩展名的.zip文件。 You just need to make sure there is no top level folder within the .zip. 您只需要确保.zip中没有顶级文件夹即可。 Your files need to be in the root of the archive. 您的文件必须位于存档的根目录中。

To deploy your static files you can either create a directory (the name of the directory will become the context path - use ROOT for the default web application) and copy your files to that directory. 要部署静态文件,您可以创建一个目录(该目录的名称将成为上下文路径-默认Web应用程序使用ROOT),然后将文件复制到该目录。 Alternatively, zip everything up, change the extension to .war and copy that to the webapps directory. 或者,压缩所有内容,将扩展名更改为.war并将其复制到webapps目录。 The name of the WAR file (minus the .war extension) becomes the context path. WAR文件的名称(减去.war扩展名)成为上下文路径。

There are numerous edge cases and details associated with the above. 与上述相关联的情况有很多。 For the full details, see the Tomcat docs: http://tomcat.apache.org/tomcat-8.0-doc/config/host.html#Automatic_Application_Deployment including the links on naming and expected behaviour. 有关完整的详细信息,请参见Tomcat文档: http : //tomcat.apache.org/tomcat-8.0-doc/config/host.html#Automatic_Application_Deployment,包括有关命名和预期行为的链接。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM