wood burning stoves 2.0*
The moose likes Tomcat and the fly likes HTML under tomcat7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTML under tomcat7" Watch "HTML under tomcat7" New topic
Author

HTML under tomcat7

Franklyn Simon
Greenhorn

Joined: Oct 05, 2013
Posts: 5
I have form file under tomcat webapp directory in a subdirectory call test

localhost:8080/test/form

Got 404 error. Can someone help? Thank
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41042
    
  43
By "form file", do you mean an HTML page? If so, it's probably named "form.html" - so the URL would be http://localhost:8080/test/form.html


Ping & DNS - my free Android networking tools app
Franklyn Simon
Greenhorn

Joined: Oct 05, 2013
Posts: 5
I was having problem submitting my question when it included html, so I left it off. But that is exactly ( http://localhost:8080/test/form.html) what I used in the browser. Therefore, I am still having the problem of getting html file to work it tomcat7. I unchecked HTML for the option now. Thanks

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Tomcat is a J2EE server. And like all J2EE servers "putting a file under a directory in Tomcat webapps" does not qualify.

Tomcat is not some kind of file server or receptacle for miscellaneous trash. It is a webapp server. If you want Tomcat to serve up content, it must be in the form of a webapp - specifically a WAR.

A WAR in strict J2EE terms is a ZIP-format (JAR) file containing certain "files" and "directories". If those components are not present, Tomcat won't recognize file as a WAR and therefore it won't recognize it as a webapp.

What causes confusion is that one of the many ways that Tomcat allows you to deploy WARs is in "exploded" form. An exploded WAR is a WAR that has been unzipped into actual directories and files, contained under a single directory, which is the name of the WAR. Which, by default, Tomcat will use as the webapp's context path root.

In other words, you can do a sloppy simple deployment of a webapp by unzipping a WAR into a directory under TOMCAT_HOME/webapps. But if it doesn't contain the basic elements of a WAR (webapp), Tomcat is likely to ignore it.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML under tomcat7
 
Similar Threads
testing in JRE
Loosing sessions between pages
In JSP, how to import a java class-in-default_package ?
struts simple program
How to avoid submit on enter?