我用http_request.open("GET", "b.jsp?username=xxx", true);向b.jsp请求处理
http_request.responseText是我的返回值
当我在b.jsp写out.print(结果);时候,结果能返回到原页面,http_request.responseText能收到原来的值
但是如果我是一个form对象,或者是个list和hashMap,又该怎么传回去呢。谢谢了

解决方案 »

  1.   

    了解一下JSON对象。
    JSON是JS的一种对象格式。
      

  2.   

    想办法拼出
    {
      "name":"john",
      "address":"天津",
      ..
    }这就是JSON格式
    http://www.json.org/
      

  3.   

    那在JSP端怎么传回来才好呢?
    我比如out.print("1");out.print("2");out.print("3");
    http_request.responseText是把所有值一起接受过来了
    var a = http_request.responseText
    a就等于123了;
      

  4.   

    你去看看 prorotype的使用吧http://www.prototypejs.org/learn/json
      

  5.   

    我觉得应该通过XML就能传输list,因为xml关于传输类型的定义比TEXT宽,hashmap同上~~~