首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

请问一上关于Jsp发送XML的有关问题

2013-01-07 
请教一下关于Jsp发送XML的问题我想请问实现让客户通过类似这样的链接:www.xxxx.com/test/text.xml获取服务

请教一下关于Jsp发送XML的问题
我想请问实现让客户通过类似这样的链接:www.xxxx.com/test/text.xml获取服务器上的XML文件呢

[解决办法]

var ajax = {//xmlhttp request
        tryList:function(){
            var xhr = null;
            for(var i=0;i<arguments.length;i++){
                var lambda = arguments[i];
                try{xhr = lambda();break;}catch(e){}
            }
            return xhr;
        },
        init:function(){
            return this.tryList(
                function(){return new ActiveXObject('MSXML2.XMLHttp.6.0');},
                function(){return new ActiveXObject('MSXML2.XMLHttp.3.0');},
                function(){return new XMLHttpRequest();},
                function(){return new ActiveXObject('MSXML2.XMLHttp.5.0');},
                function(){return new ActiveXObject('MSXML2.XMLHttp.4.0');},
                function(){return new ActiveXObject('Msxml2.XMLHTTP');},
                function(){return new ActiveXObject('MSXML.XMLHttp');},
                function(){return new ActiveXObject('Microsoft.XMLHTTP');}
                ) 
[解决办法]
 null;
        },
        post:function(sUrl,sArgs,bAsync,fCallBack,errmsg){
            var xhr = this.init();
            xhr.onreadystatechange = function(){
                if(xhr.readyState == 4){
                    if(xhr.responseText){
                        if(fCallBack.constructor==Function){fCallBack(xhr);}
                    }else{
                        //alert(errmsg);
                    }


                }
            };
            xhr.open('POST',encodeURI(sUrl),bAsync);
            xhr.setRequestHeader('Content-Length',sArgs.length);
            xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            xhr.send(sArgs);
        },
        get:function(sUrl,bAsync,fCallBack,errmsg){
            var xhr = this.init();
            xhr.onreadystatechange = function(){
                if(xhr.readyState == 4){
                    if(xhr.responseText){
                        if(fCallBack.constructor==Function){fCallBack(xhr);}
                    }else{
                        alert(errmsg);
                    }
                }
            };
            xhr.open('GET',encodeURI(sUrl),bAsync);
            xhr.send('Null');
        }
    }

ajax.get('你域下面的xml地址',true,function(xhr){alert(xhr.responseText)},"");

热点排行