日期:2014-05-20  浏览次数:20781 次

急急急!!!!!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的支持