客户端代码: var xmlHttp; function createXMLHttpRequest(){ if(window.ActiveXObject){ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }else if (window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest(); } } function sl(url){ //可加一些验证信息 document.getElementById('slform').style.display='';//打开受理form //alert("url="+url); createXMLHttpRequest();//为 xmlHttp 赋值 xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = slcallback; xmlHttp.send(null); } function slcallback(){ if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { var applyPerson = xmlHttp.responseXML.getElementsByTagName('applyPerson')[0].firstChild.data; var applyIdCard = xmlHttp.responseXML.getElementsByTagName('applyIdCard')[0].firstChild.data; document.getElementById('slPerson').value=applyPerson; document.getElementById('slId').value=applyIdCard; } }else{ } } 在action里,返回到一个jsp页面,在jsp页面里把内容设为xml格式 如下: <%@ page contentType="text/xml; charset=GBK"%> <% String applyPerson = (String)request.getAttribute("applyPerson"); String applyIdCard = (String)request.getAttribute("applyIdCard"); %> <?xml version="1.0" encoding="GBK"?> <response> <applyPerson><%=applyPerson%></applyPerson> <applyIdCard><%=applyIdCard%></applyIdCard> </response>