本文介绍了仅将 HTML、CSS 网页部署到 Tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始开发网站.目前我所拥有的只是一个 HTML 页面,由几个 CSS 样式表 支持.

I am just getting started on developing a website. All I have at the moment is a HTML page supported by a couple of CSS stylesheets.

我可以从 HTML 和 CSS 页面创建WAR 文件吗?我如何将它们部署到 Tomcat 服务器?

Can I create a WAR file from the HTML and CSS pages? How do I deploy them on to a Tomcat server?

谢谢.

推荐答案

这是我的设置:我使用的是 Ubuntu 9.10.

Here's my setup: I am on Ubuntu 9.10.

现在,这就是我所做的.

Now, Here's what I did.

  1. /usr/share 中创建一个名为tomcat6-myapp"的文件夹.
  2. /usr/share/tomcat6-myapp下创建一个文件夹myapp".
  3. 将 HTML 文件(我需要部署)复制到 /usr/share/tomcat6-myapp/myapp.它必须命名为 index.html.
  4. 转到/etc/tomcat6/Catalina/localhost.
  5. 在/etc/tomcat6/Catalina/localhost 中创建一个 xml 文件myapp.xml"(我猜它必须与步骤 2 中的文件夹名称相同)内容如下.

  1. Create a folder named "tomcat6-myapp" in /usr/share.
  2. Create a folder "myapp" under /usr/share/tomcat6-myapp.
  3. Copy the HTML file (that I need to deploy) to /usr/share/tomcat6-myapp/myapp. It must be named index.html.
  4. Go to /etc/tomcat6/Catalina/localhost.
  5. Create an xml file "myapp.xml" (i guess it must have the same name as the name of the folder in step 2) inside /etc/tomcat6/Catalina/localhost with the following contents.

< Context path="/myapp" docBase="/usr/share/tomcat6-myapp/myapp" />

  • 此 xml 称为部署描述符",Tomcat 会读取并自动部署名为myapp"的应用程序.

  • This xml is called the 'Deployment Descriptor' which Tomcat reads and automatically deploys your app named "myapp".

    现在去http://localhost:8080/myapp在您的浏览器中 - index.html 被 tomcat 选中并显示出来.

    Now go to http://localhost:8080/myapp in your browser - the index.html gets picked up by tomcat and is shown.

    我希望这会有所帮助!

    这篇关于仅将 HTML、CSS 网页部署到 Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 09-05 23:56