Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A simple html form with TomCat

 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know the basic directory structure under Tomcat is as follows :
webapps/BeerV1/ with WEB-INF/classes directly beneath that.

i built a html form saved it in BeerV1/web directory and copied it under webapps/BeerV1/form.html

also i built a XML DD file web.xml in BeerV1/etc and copied it in BeerV1/WEB-INF
but when i am running http://localhost:8080/BeerV1/form.html

error is occurring 404 resource not found. the default html pages are getting executed. please anyone help me out
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use mysite.com as the folder under web apps, that will be the context path, not BeerV1.
 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it was by mistake given as mysite, actually its BeerV1
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read AvoidRedHerrings
 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i apologize but please tell me why is the error occurring, am i missing something ??
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18276
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I know the basic directory structure under Tomcat is as follows :
webapps/BeerV1/ with WEB-INF/classes directly beneath that.


Actually, then, you DON'T know the basic directory structure under Tomcat. Tomcat employs (by default), the directory TOMCAT_HOME/webapps. Within that directory you can deploy J2EE web applications. At that point, however, you're no longer "Tomcat directory structure", you're J2EE WAR structure. Each WAR appears as a file and/or directory in Tomcat_HOME/webapps, and the structure from that point downwards is set by the J2EE standard, not by Tomcat. Within the webapps directory, if a file ending in ".war" and a directory (no extension) have the same name, Tomcat will deploy the directory version of the app and ignore the WAR file (even if it's newer than the directory version). That's assuming that you're running Tomcat with the factory options and that you didn't define an explicit Tomcat Context.

Within a WAR, the J2EE standard states that the WEB-INF folder and its children cannot be access by URL request. So anything you put there can only be used by application logic and not served directly to clients.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic