Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用ajax在jsp的显示标记中显示结果数据_Ajax_Jsp_Struts - Fatal编程技术网

如何使用ajax在jsp的显示标记中显示结果数据

如何使用ajax在jsp的显示标记中显示结果数据,ajax,jsp,struts,Ajax,Jsp,Struts,我通过ajax将请求发送到strutsaction。数据返回到ajax。在这种情况下,使用display标记在jsp div中显示数据。请给我解决方案` <display:table> <display:column></display:column> </display:table> var xmlHttp; function changFun(){ alert(document.getElementBy

我通过ajax将请求发送到
struts
action。数据返回到
ajax
。在这种情况下,使用
display标记在
jsp div
中显示数据。
请给我解决方案`

<display:table>
<display:column></display:column>
</display:table>

var xmlHttp;
        function changFun(){
            alert(document.getElementById("datepicker").value+"abcd");
            var DateValue=document.getElementById("datepicker").value;
            if (typeof XMLHttpRequest != "undefined"){
                xmlHttp= new XMLHttpRequest();
            }
            else if (window.ActiveXObject){
                xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            if (xmlHttp==null){
                alert("Browser does not support XMLHTTP Request")
                return;
            } 
            var url="abc.jsp";
            url +="?DateValue="+DateValue;
            xmlHttp.onreadystatechange = getDetails1;
            xmlHttp.open("GET", url, true);
            xmlHttp.send(null);
        }
        function getDetails1(){
            if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                //document.getElementById("hidedata").style.display="none";
                document.getElementById("ComId").innerHTML=xmlHttp.responseText; 
            }
        }

var-xmlHttp;
函数changFun(){
警报(document.getElementById(“日期选择器”).value+“abcd”);
var DateValue=document.getElementById(“日期选择器”).value;
if(XMLHttpRequest的类型!=“未定义”){
xmlHttp=新的XMLHttpRequest();
}
else if(window.ActiveXObject){
xmlHttp=新的ActiveXObject(“Microsoft.xmlHttp”);
}
if(xmlHttp==null){
警报(“浏览器不支持XMLHTTP请求”)
返回;
} 
var url=“abc.jsp”;
url+=“?DateValue=“+DateValue;
xmlHttp.onreadystatechange=getDetails1;
open(“GET”,url,true);
xmlHttp.send(空);
}
函数getDetails1(){
if(xmlHttp.readyState==4 | | xmlHttp.readyState==complete){
//document.getElementById(“hidedata”).style.display=“无”;
document.getElementById(“ComId”).innerHTML=xmlHttp.responseText;
}
}

不能将jsp与ajax混合使用,ajax是客户端,jsp是服务器端。您可以使用controller for get data and send to view(jsp)来显示数据

您的意思……您知道jsp和AJAX,请给我相关代码。@w4rumy响应数据是使用displaytag在jsp中显示的