<script>
function getSheet()
{
 var sendText = "hello";
 document.branchform.sendText.value=sendText;
 document.branchform.action="test.jsp";
 document.branchform.submit();
 }
</script><input type=hidden name = "sendText" value = "">提交后从request中得就可以了

解决方案 »

  1.   

    楼上说的方法不对的,我的意思是说在JSP里用REQUEST方法直接获取JS 里面的
    VAR sendText这个变量!有什么方法呢?
      

  2.   

    document.branchform.sendText.value=sendText;
    这句不是把 sendText 这个变量 ,赋给表单中 
    <input type=hidden name = "sendText" value = "">
    了么
    在test.jps 中,request.getParameter("sendText");
    就可以了啊
      

  3.   

    <script>
    function getSheet()
    {
     var sendText =  ="hello";
     document.branchform.action="test.jsp?sendText="+sendText;
     document.branchform.submit();
     }
    </script>