servlet responds wiyh status 4004

servlet responds wiyh status 4004

function getXMLObject()  //XML OBJECT
{
   var xmlHttp = false;
   try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) {
     try {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}

var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object

function ajaxFunction() {
  if(xmlhttp) { 
   var txtname = document.getElementById("txtname");
    xmlhttp.open("POST","http://localhost:8080/Admin/web/getname",true); //getname will be the servlet name
    xmlhttp.onreadystatechange  = handleServerResponse;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send("txtname=" + txtname.value); //Posting txtname to Servlet
  }
}

function handleServerResponse() {
   if (xmlhttp.readyState == 4) {
       alert("hyn");
       alert(xmlhttp.status);
     if(xmlhttp.status == 200) {
       document.myForm.message.innerHTML=xmlhttp.responseText; //Update the HTML Form element 
     }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }
}


SERVLET
import java.io.*;

import java.text.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class getname extends HttpServlet {

 public void init(ServletConfig config) throws ServletException { 
  super.init(config);
 }

 public void destroy() {

 }

 public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  String name = null;
  PrintWriter out = response.getWriter();
  if(request.getParameter("txtname") != null) {
   name = request.getParameter("txtname");
  }
                else {
                       name = "";
                }
           out.println("You have successfully made Ajax Call:" + name);
 }
}
View Answers

February 7, 2012 at 12:41 PM

It seems that the server is unable to find your jsp or servlet file. Either you have specified wrong path to run a jsp or servlet or may be you have saved the file with different name.

If you are running a servlet, servlet mapping is essential. Check it.









Related Tutorials/Questions & Answers:
servlet responds wiyh status 4004
servlet responds wiyh status 4004  function getXMLObject() //XML...://localhost:8080/Admin/web/getname",true); //getname will be the servlet name...=" + txtname.value); //Posting txtname to Servlet } } function
error of HTTP Status 404 while running servlet on apache tomcat server
error of HTTP Status 404 while running servlet on apache tomcat server  i have followed the steps given here.Also hava put servlet-api in lib folder... here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could
Advertisements
HTTP Status 404 - JSP-Servlet
HTTP Status 404  Respected Sir/madam, I am R.Ragavendran.. I am using J2EE1.4 SDK Application Server.. When I was working with it yesterday,Suddenly i found my server throwing the following Error: HTTP Status 404
java http 404 status error - JSP-Servlet
java http 404 status error  I have tried to call a servlet from html page.. but it is showing http 404 status error.. and the description... application folder and servlet in classes folder of apache tomcat. The web
Send a Response Status in servlet
Status in servlet       This section illustrates you how to send response status in servlet. All Response status is defined in HttpServletResponse Class. You can then use constants
problem running a servlet on tomcat.
to run my servlet that is placed in the directories as it has been mentioned here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could...problem running a servlet on tomcat.  i have followed the steps given
server status
server status   How to check the apache server status in unix machine
Database Status
Database Status  Hello Everyone, I am working on a project,its almost done with only module remaining in it i.e; it has to show the status of database in the graph chart or pie diagram in terms of percentage
error "HTTP Status 500"
error "HTTP Status 500"  How to solve this error "HTTP Status 500
Servlet
Servlet  What is Servlet
ModuleNotFoundError: No module named 'status'
ModuleNotFoundError: No module named 'status'  Hi, My Python... 'status' How to remove the ModuleNotFoundError: No module named 'status'... to install padas library. You can install status python with following command
HTTP Status 404 -
HTTP Status 404 -   HTTP Status 404 - type Status report message description The requested resource () is not available. Apache Tomcat/5.5.31 how to rectify the above error
Servlet
Servlet  how to navigate one servlet page to another servlet page
servlet
servlet  is there any way to include pdf's in servlet
servlet
servlet  How many times the servlet is accessed
servlet
servlet  what are the methods and interfaces in the servlet api ?   Servlet Tutorials
HTTP Status 500 -
HTTP Status 500 -   Hi, I am new to jsp... Installed Tomcat 5.5.... wrote. i can see these errors... HTTP Status 500 - type Exception report...\lib.*; 3)Also put the servlet api.jar file inside the lib folder. 4)Now create
ios hide status bar
ios hide status bar  HI, I am developing an application in IOS. Can anyone tell me how to? hide status bar? Thanks   Hi, Following code can be used: [[UIApplication sharedApplication] setStatusBarHidden:YES
servlet
servlet  what are the all necessary configuration to run a servlet
servlet
servlet  how to interact with a servlet from a swing program
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  i want to create a login page with servlet using database mysql? only in servlet not in jsp plzz help me out
HTTP Status 404 - Struts
HTTP Status 404   Hello, i am making a program of tiles using Struts2. i face error HTTP Status 404 May 4, 2010 11:31:59 AM...:01 AM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet
Servlet
override Service method in the servlet when you extend GenericServlet to create servlet as it is mandatory to override it. But, when you extend HttpServlet to create a servlet then you can't override service method as there is a need to override
How to retrieve the file status?
How to retrieve the file status?  Hi all, I did a project which... and Accounts. My issue is when the admin officer checks for the file status, it has to display that the file is at customs dept or accounts dept. The file status can
servlet
servlet  i want a program for counting the no of times the servlet has been invoked
Servlet
Servlet  What must be implemented by all Servlets?    The Servlet Interface must be implemented by all servlets
servlet
servlet  how to create a login form using servlet using submit,edit delete button
servlet
servlet  dear sir servlet and html not run on eclips plz help me
servlet
servlet  can i stoar record in variable which selected from table in servlet
servlet
of the Servlet API. It contains the classes necessary for a standard, protocol-independent servlet. Every servlet must implement the Servlet interface in one
Servlet
Servlet  I want to know the steps to write a simple servlet program... .   Hello Friend, Follow these steps: Put servlet-api.jar inside the lib folder of apache tomcat. 1)create a servlet. import java.io.*; import
An Assertion status in java.........
An Assertion status in java.........  What is an Assertion status in java?...........can u plz explain in detail with e:g. MoreOver, to that i have encountered with different _AssertionStatus() method in ClassLoader in java
Servlet
Servlet   Why is Servlet so popular?   Because servlets are platform-independent Java classes that are compiled to platform-neutral byte code that can be loaded dynamically into and run by a Java technology-enabled Web
servlet
servlet  i want to use servlet application on my web page then what should i do. I have already webspace.   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Servlet Tutorials Thanks
servlet
servlet  how to read a file from different folder using filereader in servlet   Hello Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/servlets/servlet-read-file.shtml Here you
Servlet
Servlet  Can a user defined function be included in a servlet? I need information regarding servlet syntax and not JSP.   Yes, you can create user defined function in Servlets. Have a look at the following link: http
servlet
servlet  I want the full coding for uploading a file in local drive D usin jsp,java class and servlet... help me thanks in advance....   ... and servlet please and thanks in advance
Servlet
Servlet  Hi, Can any one please expalin me below topics SERVLET ENGINE 2.WHY SUPER.INIT(); Thanks alot in advance!! Regards: Akash
servlet
servlet   Dear Deepak, is it compulsary to write the sevice() becoz i ve seen some example which does not ve sevice()..is it tue? plz replay me with thanks praveen
servlet
servlet  plz can anyone give me the link of javax library jar file. i badly need that. thanks in advance   Please visit the following link: Download Servlet API
servlet
servlet  I want a fully readymade project on online voting system with code in java servlet and database backend as msaccess.can u plz send me as soon as possible
Servlet
the same error <web-app> <servlet> <servlet-name>InsertServlet</servlet-name> <servlet-class>InsertServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>
servlet
servlet file which prints out the user's inputs. I need to use the post method to pass the data from html to the java servlet and also use both doGet and doPost methods in the servlet. I think, but unfortunately I have a terrible teacher
SERVLET
to the servlet and if the user id is correct then a new page will be displayed with his... pass to the servlet and all the fields brlongs to that id will be appear... will be done by using jsp and servlet... Plz help me,im really tensed...........  
ModuleNotFoundError: No module named 'api-status'
ModuleNotFoundError: No module named 'api-status'  Hi, My Python... 'api-status' How to remove the ModuleNotFoundError: No module named 'api-status' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'api-status'
ModuleNotFoundError: No module named 'api-status'  Hi, My Python... 'api-status' How to remove the ModuleNotFoundError: No module named 'api-status' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'display-status'
ModuleNotFoundError: No module named 'display-status'  Hi, My... named 'display-status' How to remove the ModuleNotFoundError: No module named 'display-status' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'get-status'
ModuleNotFoundError: No module named 'get-status'  Hi, My Python... 'get-status' How to remove the ModuleNotFoundError: No module named 'get-status' error? Thanks   Hi, In your python environment you

Ads