NHibernate 的几个问题解决方法

来源:互联网 发布:最新版牛彩暴雪源码 编辑:程序博客网 时间:2024/05/22 00:06

function validate(url,updateElemID){
    
//window.alert(paras);
    var myAjax=new Ajax.Request(url,
    
{
    
//method:'get',
    method:'post',
    
//parameters: paras, //不知怎么回事这个parameter总是传不过去         
    onComplete:function(originalRequest){showResponse(originalRequest,updateElemID)}
    }

    );                           
}

function showResponse(originalRequest,elemID){
      
//var html = originalRequest.responseText;
          //var html=originalRequest.responseXML.getElementsByTagName("dd")[1].firstChild.data;
       //$(elemID).innerHTML = html;
     //     var isShowDiv=originalRequest.responseXML.getElementsByTagName("res")[0].firstChild.data;  
     //     window.alert(isShowDiv);       
     //  $("jobType").style.display=isShowDiv;
       
     
     
var myDocument = new ActiveXObject("Microsoft.XMLDOM"
    
//myDocument.async="false"; 
    myDocument.loadXML(originalRequest.responseText);  
  window.alert(myDocument); 
    
var myRoot = myDocument.documentElement; 
     
// window.alert(myRoot);     
    var isShowDiv= myRoot.getElementsByTagName("res")[0].firstChild.data;
    
var html=myRoot.getElementsByTagName("font")[0].firstChild.data;
    
//window.alert(isShowDiv);
    //window.alert(html);
    $(elemID).innerHTML = "<font color='red'>"+html+"</font>";
    $(
"jobType").style.display=isShowDiv;
    
       
  }
 

 

今天使上面这段代码,想从服务端转两段数据过来,一段用来显示白提示,一段用来控制一个div的显示和隐藏。所以我想到了传一个responseXML
结果在调试中出现很多问题,显示不出来,搞了半天,分析总结了如下:
1、在服务器必须写成xml文件格式,还不能用写两个out.println()语句来写那两段文字,必须写能一段XML文件,用两个的子节点来写那两段文字。
2、在jsp页面上显示时,要这样写才能获取到documentElement
  var myDocument = new ActiveXObject("Microsoft.XMLDOM") 
    myDocument.async="false";
    myDocument.loadXML(originalRequest.responseText); 
  window.alert(myDocument);
    var myRoot = myDocument.documentElement;
在页面上getElementsByTagName("font")[0].firstChild.data;的时一定要get在服务端有写的元素,不然也会导致其它正确的显示不出来。

引用

http://www.blogjava.net/xyzroundo/articles/184323.html