action="b.jsp?a=a&b=b"b.jsp:
alert(location.search.substring(1))

解决方案 »

  1.   

    b.jsp:
    <head>
    <script>
        function hehe()
        {
            var query = location.search.substring(1);//获取URL中?后面的字符串
             var data = query.split("=");
            start(data[0].data[1]);
        }
        window.onload=hehe;
    </script>
    </head>
    <body>
    <input type="text" id="test" />
    </body>
      

  2.   

    a.jsp 传2个值到b.jsp
    例如:
    b.jsp?a=10&b=20
    b.jsp用JS取2个值
    b.jsp写:
    function aa(aa,bb)
    {
       aa=location.search.substr(1).split("&")[0].split("=")[1];
       bb=location.search.substr(1).split("&")[1].split("=")[1];
      alert(aa+"和"+bb);
    }
    输出结果:10和20
    其他情况依次类推!
      

  3.   

    这两个jsp是不是在一个框架页中呢?