Ajax代码: <mce:script type="text/javascript"> function changeAmount(pid,amount){ var newamount= document.getElementById(pid+"_"+amount).value; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if(window.ActiveXObject){ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ if(xmlhttp.status ==200){ var text=xmlhttp.responseText; var price = text.split(";"); document.getElementById("lbTotalPrice").innerHTML = price[0]; document.getElementById("totalprice_" + pid).innerHTML = price[1]; } } } xmlhttp.open("GET","changeAmount.htm?pid="+pid+"&amount="+newamount,false); xmlhttp.send(null); } </mce:script> Struts配制文件代码: <!-- 数量修改 --> <action path="/changeAmount" type="com.tarena.xindou.index.action.OrderOperation" parameter="changeAmount"> <forward name="cart" path="tarena.xindou.cart"></forward> </action> Action代码段: try{ response.getWriter().print(sumStr + ";" + totalpriceStr); }catch(Exception ex) { ex.printStackTrace(); }