<%@   page   contentType="text/html"%>   
  <form   method=post>   
  <input     name=x   value=''>   
  <script>   
  function _change()   
  {   
   var rnd="";    for(var i=0;i<12;i++)
        rnd+=Math.floor(Math.random()*10);
      document.all.x.value=rnd;   
  }   
  _change();   
  </script>   
  <%   
  String   x=request.getParameter("x");    
   System.out.println("the value X is :"+x); 
  %>   
  </form>

解决方案 »

  1.   

    还没进request呢,没办法得到的
      

  2.   

    <%@   page   contentType="text/html"%>   
      <form   method=post>   
      <input     name=y   value=''>   
      <script>   
      function   _change1()   
      {   
          document.all.y.value="this is a test";   
      }   
      _change1();   
      </script>   
      <%   
      String   y=request.getParameter("y");   
      System.out.println("the value Y is :"+y);   
      %>    
      </form>  
    但是为什么这样可以打印the value Y is :this is a test呢??
      

  3.   

    不会吧,怎么可能会有the value Y is :this is a test呢
      

  4.   

    <%@   page   contentType="text/html"%>   
      <form   method=post>   
      <input     name=y   value=''>   
      <script>   
      function   _change1()   
      {   
          document.all.y.value="this is a test";   
      }   
      _change1();   
      </script>   
      <%   
      String   y=request.getParameter("y");   
      out.println("the value Y is :"+y);   
      %>    
      </form>  
    不信打到前台看看
      

  5.   

    解决了
    加个<input type = "submit">即可