title: Fetching Java variable from JSP into Script tag
body: <p>I am writing a JSP and have the Java code written in the <code>&lt;code&gt;</code> tags.</p>
  
  <p>I would like to use a Java variable which is inside the <code>&lt;code&gt;</code> tag, inside the script tag. </p>
  
  <p>Example:- </p>
  
  <pre><code>  &lt;html&gt;
      &lt;head&gt;
      var myJSVar = $(myJavaVariable)//Something like this and this doesn't work
      &lt;/head&gt;
      &lt;body&gt;
      &lt;pre&gt;
      &lt;code&gt;
       String myJavaVariable = "Sample String";
      &lt;/code&gt;
      .....
  </code></pre>
  
  <p>Thanks!!!!</p>