aspose file tools*
The moose likes Servlets and the fly likes 404 error or resource not available error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "404 error or resource not available error" Watch "404 error or resource not available error" New topic

404 error or resource not available error

budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
1. i hav made a deployemnt environment which is "C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Beer-v1"
2. inside the Beer-v1 i hav put form.html
here's the code for form.html
<h1 align="center">Beer Selection</h1>
<form method="post" action="/Beer-v1/">
Select Beer Characteristics
Color :
<select name="color" size="l">
<option value="light">light</option>
<option value="green">green</option>
<option value="brown">brown</option>
<option value="amber">amber</option>
<option value="dark">dark</option>
<input type="Submit" value="submit">
3. Directory of web.XML "C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\Beer-v1\WEB-INF"
4. The servlet the post method will call(it compiles whout ne error)
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class beer extends HttpServlet
public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
PrintWriter out = res.getWriter();
out.println("Beer Selection Advice<br>");
String c=req.getParameter("color");
out.println("<br>Got Beer Color"+c);
5. the web .xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
6. beer.class file's directory "C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Beer-v1\WEB-INF\classes\com\example\web"
7. now wen i run the server and type "http://localhost:8080/Beer-v1/form.html" on the browser i see the form but when i click the submit button i get http error 404 or should i say not found .help me please
tong yuxin

Joined: Jul 21, 2008
Posts: 19
try this , make the action as same as your url/mapping.
we are reading the same book. woo! really good book.
<h1 align="center">Beer Selection</h1>
<form method="post" action="">
Select Beer Characteristics

SJCP 98%
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
tried that didn't work .
dude could you send me
the details of your environment variables. i think they are the source of problems.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42289
Environment variables have nothing to do with this.

The very files you posted work just fine for me. Have you restarted the web app after deploying them?

Ping & DNS - my free Android networking tools app
Vibhuti Goel

Joined: Sep 24, 2008
Posts: 3
i am having the same problem. and I've tried restarting the web-app many times. but its still not working
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
Thanks for your time man!
And yes i have redeployed Again and again . I shutdown the server ,close the browser and then restart the whole thing.
I have jdk and apache installed am i missing anything else???
Which sw's do you have installed???
I agree. Here's the link:
subject: 404 error or resource not available error