当前位置: 代码迷 >> J2EE >> 急ajax有关问题
  详细解决方案

急ajax有关问题

热度:285   发布时间:2016-04-22 03:34:37.0
急急急!!!!!ajax问题
怎么能从ajax中把form表单中的数据传到sturns中的action中呢? 不用在url中添加参数 就能直接传到action中


------解决方案--------------------
ajax 实现跳转不就是HttpXMLRequest req.open("GET","temp.do?a=1",true);
req.send(null);

这样不可以吗
------解决方案--------------------
var oXmlHttp=zXmlHttp.createRequest();//获得XMLHTTPREQUEST对象
oXmlHttp.open("post","*.do",true);
oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
oXmlHttp.onreadystatechange=function(){
if(oXmlHttp.readyState==4){
if(oXmlHttp.status==200){
var oxml=oXmlHttp.responseXML;
}else{
return;
}
}
};
oXmlHttp.send("****");//提交的ACTIONFORM变量名与提交内容,如name=aa&passs=bb

name就是ACTIONFORM 中定义的
private String name;
------解决方案--------------------
Struts2提供了Ajax的支持
  相关解决方案