将 Web 项目导出到 war 文件

Export web project to war file

抱歉,如果问题很基础,因为我在这方面还是新手。

我写了JSP页,那个servlet中的调用方法。

起初我 运行 它在 eclipse 上使用 Tomcat 服务器。成功后,我使用 Eclipse 将项目导出到 war 文件中。这会生成单个文件 "project.war",我将其放在 apache 主文件夹下的文件夹 "webapps" 中。 在我启动服务器并从浏览器调用应用程序后,我注意到在 webapps 文件夹中创建了额外的文件夹,其中包含项目名称,并且在 JSP 使用的所有相关 java/jars 文件中。

我想了解这个文件夹是如何创建的,因为导出生成了单个 war 文件? 更重要的是,如果我想在网络上托管应用程序(例如 google 引擎应用程序),我应该上传什么?我在某处读到只有 war 文件,但不清楚如何获取其他相关文件?

谢谢

War 对开发人员更重要,在您的问题中,您将仅上传 War 文件。

A web application is defined as a hierarchy of directories and files in a standard layout. Such a hierarchy can be accessed in its "unpacked" form, where each directory and file exists in the filesystem separately, or in a "packed" form known as a Web ARchive, or WAR file. The former format is more useful during development, while the latter is used when you distribute your application to be installed.

每个 War 后跟 war 代表的项目 的根文件夹。将有解压的 War 文件和以下 files.So 基本上这是服务器的工作,或者在你的情况下本地服务器 Apache Tomcat 解压你的 War 存档并使其在网络上可用(在你的情况下是本地主机)。

The top-level directory of your web application hierarchy is also the document root of your application. Here, you will place the HTML files and JSP pages that comprise your application's user interface. When the system administrator deploys your application into a particular server, he or she assigns a context path to your application. Thus, if the system administrator assigns your application to the context path /catalog, then a request URI referring to /catalog/index.html will retrieve the index.html file from your document root.

此外,我建议您阅读 documentation 有关此主题的内容。