File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes placing HTML files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "placing HTML files " Watch "placing HTML files " New topic

placing HTML files

madhur jain
Ranch Hand

Joined: Aug 27, 2002
Posts: 49
i am a beg. in servlets.
the dir.
is where i place my servlets and i execute them using
but can some one tell me where should i place the static html pages that need to post data to the servlet
<form action="servletclass" method=post> should post data to the servlet named "servletclass"
in which dir. should i place the html page.
Ken Robinson
Ranch Hand

Joined: Jul 25, 2002
Posts: 52
Instead of using the JSDK2.1 by itself, I would recommend getting the J2EE1.3.1 instead. J2EE includes everything in the Servlet API and is more current (Servlet Spec 2.3).
Next I would get Tomcat (4.1.12 I believe is current) from This is a free webserver that implements the 2.3 spec.
Finally, I would become familiar with the directory structure of the Web ARchive (.war file). ANY J2EE server (Tomcat, WebLogic, WebSphere, JBoss) MUST support this. The .war file and it's structure define exactly what you are looking for and more. The location of static file, config files, servlet classes and anything else required are predermined. This not only standardizes practices, it ensures that your app is portable since the structure is supported by each server. You will not get that portability coding to the 2.1 spec implementation.
[ October 04, 2002: Message edited by: Ken Robinson ]
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
This is the standard web app directory structure:
The context root should be something like:

Your JSP pages and HTML files would be anywhere after the /myWebApp like so:

Your servlets would reside in:

Hope this helps,

SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
I agree. Here's the link:
subject: placing HTML files
It's not a secret anymore!