This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes The requested resource () is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The requested resource () is not available" Watch "The requested resource () is not available" New topic

The requested resource () is not available

roshan laddu

Joined: Aug 27, 2008
Posts: 9
Following appears when i open html in browser by --http://localhost/servlets/ThreeParamsForm.html
HTTP Status 404 -
type Status report
description The requested resource () is not available.
Apache Tomcat/6.0.18
please help me
import javax.servlet.*;
import javax.servlet.http.*;
/** Simple servlet that reads three parameters from the
* form data.
public class ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
String docType =
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
"<UL>\n" +
" <LI><B>param1</B>: "
+ request.getParameter("param1") + "\n" +
" <LI><B>param2</B>: "
+ request.getParameter("param2") + "\n" +
" <LI><B>param3</B>: "
+ request.getParameter("param3") + "\n" +
"</UL>\n" +
<TITLE>Collecting Three Parameters</TITLE>
<H1 ALIGN="CENTER">Collecting Three Parameters</H1>
<FORM method="POST" ACTION="">
First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
<web-app xmlns=""

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61066

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]

Joined: Sep 13, 2008
Posts: 1

There is a spelling mistake in Servlet name of Web.xml file. Change it....

Also make sure that the .class file is getting into appropriate folder under Classes folder.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61066

"Java Thirsty", please check your private messages for an important administrative matter.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12769
Your use of the directory "servlets" and the following:

placement of a class in the default package rather than a defined package suggest you are following out-dated advice and trying to rely on the "invoker" servlet.

Go read this FAQ entry right now.

Use of the invoker is a REALLY BAD IDEA!

aleem khan
Ranch Hand

Joined: Aug 07, 2008
Posts: 94
Since you are not able to access .html itself the tomacat has not started properly. After starting tomcat please verify that you are able to acces the default tomacat website/webpage. Then again once you are able to access the html file it prompts to enter some data (as per your code). After you enter the details and click submit button again it will throw error unless you correct the spelling of "servlet" as some one has already pointed out. Incorrect spelling "servlet" is noway related to the .html file.

SCJP(1.4), SCWCD, Oracle 9i SQL certified, Oracle PLSQL Developer Certified Associate
It is sorta covered in the JavaRanch Style Guide.
subject: The requested resource () is not available