Deploying HTML Only, CSS Web Pages for Tomcat

I am just starting to develop a website . All I have at the moment is an HTML page supported by a couple of CSS styles .

Can I create a WAR file with HTML and CSS pages ? How to deploy them to a Tomcat server ?

Thank.

+74
html css tomcat web-deployment-project
Oct 17 '10 at 18:27
source share
3 answers

Here is my setup : I'm on Ubuntu 9.10.

Now, here is what I did.

  • Create a folder named " tomcat6-myapp " in / usr / share .
  • Create the myapp folder in the / usr / share / tomcat6-myapp section .
  • Copy the HTML file (which I need to deploy) to / usr / share / tomcat6-myapp / myapp . It needs to be called index.html .
  • Go to / etc / tomcat6 / Catalina / localhost .
  • Create the xml file " myapp.xml " (I assume that it should have the same name as the folder name in step 2) inside / etc / tomcat 6 / Catalina / localhost with the following contents.

    < Context path="/myapp" docBase="/usr/share/tomcat6-myapp/myapp" /> 
  • This xml is called " Deployment Descriptor ", which Tomcat reads and automatically deploys your application called " myapp ".

  • Now go to http: // localhost: 8080 / myapp in your browser - index.html is received by tomcat and shown.

Hope this helps!

+27
Oct 18 '10 at 11:55
source share

There is no real need to create a war to launch it from Tomcat. You can follow these steps.

  • Create a folder in the webapps folder, for example. Myapp

  • Put html and css in this folder and name the html file you want to become the start page for your application, index.html

  • Launch tomcat and point the browser to the URL "http: // localhost: 8080 / MyApp". Your index.html page will appear in the browser

+132
Oct 18 2018-10-10T00:
source share

Here is my step in Ubuntu 16.04 and Tomcat 8.

  1. Copy the / var / lib / tomcat8 / webapps / ROOT folder to your folder.

    cp -r / var / lib / tomcat8 / webapps / ROOT / var / lib / tomcat8 / webapps / {your folder}

  2. Add your HTML, CSS, JS, to your folder.

  3. Open " http: // localhost: 8080 / {yourfolder}" in a browser

Notes:

  1. If you previously used the Chrome browser and incorrectly specified the folder, then clear the web browser cache (or change a different name), otherwise (sometimes) it will always be 404.

  2. Need a META-INF folder with context.xml.

+2
Jun 28 '17 at 9:48 on
source share



All Articles