Ciao a tutti,
sto studiando da poco AJAX
il mio problema č il seguente ho una pagina HTML che richiede una richiesta al server( paginajsp)
da un bottone richiama una funzione in javascript viene creato il doc.xml da spedire al server
il server:
riceve il parametro
lo trasforma in oggetto xml
procede con la query ,insert ,select ecc
generail doc xml di risposta della elaborazione.

il client
legge la risposta del server elabora la risposta per leggere il TAG errore/MSID
Questo č in grandi linee l'esercizio
adesso tralasciamo la parte dello statement SQL e la generazione degli errori a me interessa la richiesta XMLHTTP nel Javascript
č qui che si blocca il tutto .
Premetto che sono all'inizio dello studio portate pazienza, questo č il codice delle due pagine:
HTML
codice:
<html>
  <head>
    <title></title>
  </head>

  <script type="text/Javascript">
  function prova() {
  	var xmlDATA
  	var xmlHTTP;
  	
		if (window.ActiveXObject) // code for IE
			{
			xmlDATA = new ActiveXObject("Microsoft.XMLDOM");
			}
		else 
                
			{
			xmlDATA = document.implementation.createDocument("", "", null);
			}


  	
  		if (window.ActiveXObject){
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            if (xmlHttp ==  null){
                xmlHttp = new ActiveXObject ("Msxml2.XMLHTTP");
            
                }
       alert("sono arrivato qui1");
            }
        else if (window.XMLHttpRequest){
            xmlHttp = new XMLHttpRequest();
        }
        else{
            alert("ATTENZIONE: La versione del Browser non � compatibile./n"+
				  "Descrizione Errore: The XMLHttpRequest nor ActiveXObject object could not be created.");
			return false;
       }
         alert("sono arrivato qui2");
	   xmlHTTP.open("POST","SVRXMLDOM.jsp",false);

    
       var strXML  = "<XMLDATA>"
           strXML += "<DATA1>"
           strXML += "<IDPAR1>" + window.TXTVALORE.value + "</IDPAR1>"
           strXML += "</DATA1>"
           strXML += "</XMLDATA>"
  
           xmlHTTP.Send(strXML);
    

	   if (window.ActiveXObject)
	      xmlDATA.load(xmlHTTP.responseXML);
	   else // code for Mozilla, Firefox, Opera, etc.
		parserXMLFilter=new DOMParse();
	      xmlDATA=parserXMLFilter.parseFromString(xmlHTTP.getResponseText(),"text/xml");

    
    	alert(xmlHTTP.getResponseText());
   
	   if (window.ActiveXObject)
			alert(xmlDATA.xml);
		else {
			var serializer = new XMLSerializer();
			alert( serializer.serializeToString(xmlDATA.getElementsByTagName("CLIENTE").item(0)) );
		}
  }
  </script>
  <body>
  <center>Pagina test comunicazione Client/Server</center>
  

  <INPUT NAME="TXTVALORE" SIZE="10">
  <input type="button" value='test' onclick='prova();'>
  </body>
</html>
e questa č la jsp
codice:
<%@page contentType="text/xml"%>
<%@page import="java.sql.*"%> 
<%@page import="java.io.*"%>
<%@page import="javax.xml.parsers.*"%>
<%@page import="javax.xml.transform.*"%>
<%@page import="javax.xml.transform.dom.*"%>
<%@page import="javax.xml.transform.stream.*"%>
<%@page import="org.w3c.dom.*"%>
<%
   // PARTE SERVER
   // ANALIZZIAMO DIVERSE CASISTICHE DI ERRORI
   /*
    Per visualizzare in HTML o XML basta cambiare la direttiva
    */
   //out.println("<RISPOSTA>");
    try {
        // Creo una stringa che legge un documento XML
        String parHTTP ="";//creo una variabile sar� la copia del send
        BufferedReader in = new BufferedReader(new 
        InputStreamReader(request.getInputStream()));  
        parHTTP = in.readLine();
        in.close();
        // VARIABILI
        DocumentBuilderFactory dbffactory = null; // ? il contenitore di tutto il lavoro
        DocumentBuilder domBuilder = null; // mette dentro il motore Dom, messo dentro il Factory
        Document docXML = null;  // dcumento finale      
        dbffactory = DocumentBuilderFactory.newInstance();
        domBuilder.parse(new StringBufferInputStream(parHTTP) );
        docXML = domBuilder.parse(new StringBufferInputStream(parHTTP));
       // Fase 1 - Connessione
          //  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           // Connection con = DriverManager.getConnection("jdbc:odbc:dbazienda","root","");
             Class.forName("com.mysql.jdbc.Driver");
            Connection con =
                    DriverManager.getConnection("jdbc:mysql://localhost/dbaziendale?user=root&password=");
       // Fase 2 - Creazione Statment: gestisce i comandi SQL
            Statement stmt = con.createStatement();// ? COLLEGATO alla Connection
            ResultSet rs;
            
           String wSQL = "select * from vw_clienti_validi1";
           rs = stmt.executeQuery(wSQL);
           out.println("<CLIENTE>");
           int trovato = 0; // variabile di verifica presenza tabella
            while (rs.next()) {
                out.println("<RECORD>");
                out.println("<COD>" + rs.getString("CLI_COD") + "</COD>");
                out.println("<RAG>" + rs.getString("CLI_RAG") + "</RAG>");
                out.println("<IND>" + rs.getString("CLI_IND") + "</IND>");
                out.println("<STS>" + rs.getString("CLI_STS") + "</STS>");
                out.println("</RECORD>");
                trovato = 1;
            }
            out.println("</CLIENTE>");
            con.close(); 
            // caso 1 Verifico che la tabella sia esistente
            if (trovato == 0) {
                out.println("<ERRORE>");
                out.println("<RECORD>");
                out.println("<CODICE>02</CODICE>");
                out.println("<DESCRIZIONE> Dati non presenti in archivio </DESCRIZIONE>");
                out.println("</RECORD>");
                out.println("</ERRORE>");
            } else {
                out.println("<ERRORE>");
                out.println("<RECORD>");
                out.println("<CODICE>00</CODICE>");
                out.println("<DESCRIZIONE> Nessun Errore Presente </DESCRIZIONE>");
                out.println("</RECORD>");
                out.println("</ERRORE>");
                }
    } 
    catch (Exception e) {
        // caso 2
        out.println("<ERRORE>");
        out.println("<RECORD>");
        out.println("<CODICE>01</CODICE>");
        out.println("<DESCRIZIONE>" + e.toString() + "</DESCRIZIONE>");
        out.println("</RECORD>");
        out.println("</ERRORE>");
    }
    out.println("</RISPOSTA>");
%>
questa č la mia versione del Browser
Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.1.8) Gecko/20071004 Iceweasel/2.0.0.8 (Debian-2.0.0.6+2.0.0.8-0etch1)
uso netbeans5.5
come compilatore
spero di avervi dato tutte le indicazioni necessarie
Mi aiutate a far funzionare il javascript
grazie
Michele