I am making a small website as my first project. I have finalized to use Java Servlets and JSP for my Server-side scripting. I am learning it from O'Reilly's HeadFirst Servlets and JSP. I decided to use Apache-Tomcat as my web server and container. I downloaded it. I even have jdk 1.6 update 21. I unzipped apache in C: It is running successfully as i get the default Tomcat home page when I type http://localhost:8080 in my browser.
In chapter 3 there is a small project called beer.
So I tried to make it.
I created a directory called beer under webapps C:\apache-tomcat-7.0.0\webapps\beer
. Inside it to just check the basics I created a html file called form.html
. But when I try to access it via the browser http://localhost:8080/beer/form.html
I get the following error:
HTTP Status 404 - /beer/form.html
type Status report
message /beer/form.html
description The requested resource (/beer/form.html) is not available.
Apache Tomcat/7.0.0
I have even tried using tomcat 6, but to no use.
Thank you for replying... Actually my doubt is..that here i am trying to access a .html file which is not a servlet so does it even require a Deployment description????
well, there is only 1 servlet i planned to make (initially)....the one which is mentioned in the form (action= "....") in the html file i made.... so i thought of checking the basic html file before i deployed a servlet....btw...if i have to include the html file also in the DD, then what should i write in place of ServletName in the xml code u gave? here are the contents of my web.xml (i modified it as u said...but dunno what to write in the Servlet Name)
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>html page</servlet-name>
<servlet-class>form</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>html page</servlet-name>
<url-pattern>/beer/form.html</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
</web-app>