jsp:
function showHint(str)
{
var xmlhttp;
if (str.length==0)
  { 
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
    xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {  
       document.getElementById("payn").innerHTML=xmlhttp.responseText;//这条语句得不到数据,有人说要用json传,我不知道该怎么操作。。
      
       }
  }
xmlhttp.open("get","<%=path %>/fee/queryfee.do?pay_no="+str,true);
xmlhttp.send();
}java类:
//解析返回的数据体内容
ResDataInfo dataBody = CommXML.readFeeInfoXML(str); session.setAttribute("fee", dataBody);// dataBody 值已经得到了,这样传不到前台去
action:
<action path="/queryfee" type="cn.edu.sdu.framework.bs.BaseAction" scope="session" name="feeForm">
<forward name="next" path="/WEB-INF/jsp/fee/addfee.jsp" contextRelative="true"></forward></action>
//这个写法上好像有什么讲究,但是我不知道该怎么操作,急切希望懂的人能指点一下。
qq594865120 小弟先行谢过

解决方案 »

  1.   

    你把xmlhttp.responseText的值alert出来看看是啥
      

  2.   

    是不是你动态页出错了?加一个分支看看
    xmlhttp.onreadystatechange=function()  {
      if (xmlhttp.readyState==4 )
      {  
    if(xmlhttp.status==200)
      document.getElementById("payn").innerHTML=xmlhttp.responseText;//这条语句得不到数据,有人说要用json传,我不知道该怎么操作。。
    else alert('-----------出错了,检查你的动态页')
       
      }
      }
      

  3.   

    额xmlhttp.responseText啥也输出不来,页面也没错误,好像是值不能这么传,好像要用json
    才能传过来郁闷得很,那个action跳转也不知道那样写对不对,不用ajax是没问题的,用了之后就得不到值了。。