例如:
后退链接 <a href="user-query.jsp?strCname=<%=strCname %>" >
页面处理,重新调用一遍ajax <% String strCname = ParamUtil.getString(request,"strCname",""); //System.out.println("strCname------->"+strCname); if(!strCname.equals("")){ %> <script language="JavaScript"> var xmlHttp; function createXmlHttp(){ if (window.ActiveXObject){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }else if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest() } return xmlHttp; } document.getElementById("username").value= '<%=strCname %>'; var name = '<%=strCname %>' ; var xhr = createXmlHttp(); xhr.onreadystatechange = function(){ if(xmlHttp.readyState==4){ if(xmlHttp.status==200){ var result = xhr.responseText ; document.getElementById("list").innerHTML = result; } } } //打开链接 var strUrl="userQuery_ajax.jsp?strCname=" + name + ""; //发送 xhr.open("GET",strUrl,true); //发送 xhr.send(null); </script> <%} %>原文链接:https://www.f2er.com/ajax/162187.html