title: onClick jsp button function
body: <p>I want to trigger a function when I click on a button in jsp file.
  I write this code:</p>
  
  <pre><code>    &lt;%!public void PrintOut(){
  System.out.println("okk");
  } %&gt;
        &lt;body&gt;
   &lt;button onclick="PrintOut()"&gt; print OK&lt;/button&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p>but it doesn't work.
  and when I use the</p>
  
  <pre><code> `&lt;script&gt;
  function myFunction(){&lt;%
  System.out.println("OKK");%&gt;}
  &lt;/script&gt;`
  </code></pre>
  
  <p>it execute before I click on button.</p>