• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The requested resource () is not available

 
roshan laddu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following appears when i open html in browser by --http://localhost/servlets/ThreeParamsForm.html
---------------------------------------------
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Apache Tomcat/6.0.18
-----------------------------------------------------------------
please help me
----------------------------------------------------------------
C:\jdk1.6.0_03
C:\jre1.6.0_03
C:\Tomcat6.0\webapps\servlets
C:\Tomcat6.0\webapps\servlets\ThreeParamsForm.html
C:\Tomcat6.0\webapps\servlets\WEB-INF\web.xml
C:\Tomcat6.0\webapps\servlets\WEB-INF\classes\ThreeParams.class
----------------------------------------------------------------
ThreeParams.java:
*****************
import java.io.*;
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 {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
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" +
"</BODY></HTML>");
}
}
---------------------------------------------------------
ThreeParamsForm.html:
*********************
<HTML>
<HEAD>
<TITLE>Collecting Three Parameters</TITLE>
</HEAD>
<BODY BGCOLOR="#FDF5E6">
<H1 ALIGN="CENTER">Collecting Three Parameters</H1>
<FORM method="POST" ACTION="ThreeParams.do">
First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
<CENTER><INPUT TYPE="SUBMIT"></CENTER>
</FORM>
</BODY>
</HTML>
----------------------------------------------------------------------
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>
<servlet-name>sevlets</servlet-name>
<servlet-class>ThreeParams</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servlets</servlet-name>
<url-pattern>/ThreeParams.do</url-pattern>
</servlet-mapping>
</web-app>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Ravi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Java Thirsty", please check your private messages for an important administrative matter.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!



Bill
 
aleem khan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic