jQuery in Action, 2nd edition*
The moose likes Tomcat and the fly likes HTTP 404 Servlets do not run Tomcat 5.0. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTTP 404 Servlets do not run Tomcat 5.0." Watch "HTTP 404 Servlets do not run Tomcat 5.0." New topic

HTTP 404 Servlets do not run Tomcat 5.0.

mallika arora

Joined: Aug 02, 2007
Posts: 5
I am trying some examples from Head First Servlet book. I have J2SDK 1.4.2_13 installed with Tomcat 5.0. HTML page opens fine when I do http://localhost:8080/Beerv1/form1.html but when this HTML page calls Servlet, it gives HTTP status 404 error.

Here is what's in web.xml:

<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-name>Ch3 Beer</servlet-name>

<servlet-name>Ch3 Beer</servlet-name>

Here is Servlet code:

package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeerSelect extends HttpServlet

public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
PrintWriter out=response.getWriter();
out.println("Beer Selection Advice<br>");
String c = request.getParameter("color");
out.println("<br>Got beer color" + c);

This is HTML page calling Servlet:

<h1 align="center">Beer Selection Page</h1>
<form method="POST" action="SelectBeer.do">Select beer characteristics<p>
Color:<select name="color" size="1"
<input type="SUBMIT"

Please advice. Is there any Tomcat settings that need to be changed?
I agree. Here's the link: http://aspose.com/file-tools
subject: HTTP 404 Servlets do not run Tomcat 5.0.
Similar Threads
Servlet code problem....from HFSJ
Getting problem with post method
Headfirst ch3 Beerselect submit button not working
Really need help on The requested resource (/SelectBeer.do) is not available.
Starting out on Servlets - from Head First Servlets and JSP