Van de Graff Van de Graff - 19 days ago 7
CSS Question

Deploying just HTML, CSS webpage to Tomcat

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.

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

Thanks.

Answer

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

Now, Here's what I did.

  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"/>

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

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

I hope this helps!