title: Assign JavaScript variable to Java Variable in JSP
body: <p>Ello there,</p>
  
  <p>I'm trying to assign the value of a javascript variable to a java variable. But I don't have clue how to do this? Say for example I have this:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
     &lt;script type="text/javascript"&gt;
         function return variable(){
            var a = "hello";
            return a;
         }
     &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;%
     //The java code
     String b = //how do I get that javascript variable here?
  %&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>