Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Ajax servlet responds wiyh status 4004
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


brisi
servlet responds wiyh status 4004
1 Answer(s)      2 years and 10 months ago
Posted in : Ajax


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);
 }
}

Advertisement
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
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
Advertisements
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
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
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
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
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
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
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
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
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
HTTP Status 500 -
HTTP Status 500 -   I've installed my Java libraries, and I am successfully able to compile and run Jave files from the command line. However, when I.... TTP Status 500 - type Exception report message description The server
Error : http status 500?
Error : http status 500?  hello sir, am using netbeans6.7.1 version i implemented one program i.e web application ..when am excuting this one i got one error http status 500...please solve this error ..when did i mistakn
404 status received in xmlhttp.status - Ajax
404 status received in xmlhttp.status  Hi! I tried out the code I found here using the AJAX login page. However, instead of using PHP for the server... is that I am getting the status 404, instead of 200. thus, I am unable
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
HTTP Status 404 - /Login/userdetail.java
HTTP Status 404 - /Login/userdetail.java  I using netbeans to coonect.. why always error.. help pls.. thx index.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <
http status 404-servlet action is not available - Struts
http status 404-servlet action is not available  hi, i m getting "http status 404-servlet action is not available" in my tomcat5.5 and i m using struts2.0.14 what is the problem pls tell me
HTTP Status 404 - /user/AddToCart.do - Struts
HTTP Status 404 user AddToCart   Hi, I download the JSP source code to run the online shopping cart. Whenever I try to add a Item to cart, it shows me the error page with HTTP Status 404 - /user/AddToCart.do What
Struts 2 : Http Status Error 404 - Struts
Struts 2 : Http Status Error 404  Hi All, I'm facing the below...: --------------------------------------------------------------------------HTTP Status 404 - /StrutsHelloWorld/act/cooler.action type Status reportmessage /StrutsHelloWorld
Also HTTP Status 404 - /Login/userdetail.java
Also HTTP Status 404 - /Login/userdetail.java  same can't to run.. error also please help.. index.jsp <%@page pageEncoding="UTF-8"%> <html> <head> <meta http-equiv="Content-Type" content
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios  ...(ServletConfig sc){ System.out.println("init() login servlet... IOException,ServletException{ System.out.println("service() login servlet
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios  ...(ServletConfig sc){ System.out.println("init() login servlet... IOException,ServletException{ System.out.println("service() login servlet
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios  ...(ServletConfig sc){ System.out.println("init() login servlet... IOException,ServletException{ System.out.println("service() login servlet
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios  ...(ServletConfig sc){ System.out.println("init() login servlet... IOException,ServletException{ System.out.println("service() login servlet
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios  ...(ServletConfig sc){ System.out.println("init() login servlet... IOException,ServletException{ System.out.println("service() login servlet
How to write program to show status of seats(i.e.free or reserve) in java?
How to write program to show status of seats(i.e.free or reserve) in java?  I have retrieved data from database table and I want to display status of seats i.e.free or reserved
HTTP Status 405 - Request method 'GET' not supported. Its urgent
HTTP Status 405 - Request method 'GET' not supported. Its urgent  When I use window.open('/admin/provisionNodeSamlPost.do?actionType=metadataview') in onclick method, following error is displaying in new window. "HTTP Status 405
 

 

 

DMCA.com