• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP 404 Servlets do not run Tomcat 5.0.

mallika arora
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic