title: Call a bean in JSP from button
body: <p>How do i call a method from a jsp when i click in a button?</p>
  
  <p>I wrote this code,but dont work..</p>
  
  <pre><code>&lt;%@page import="my.package.class.MyClass" %&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="submit" name="myButton" value="button" onclick="callMethod()"/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;%! 
  void callMethod(){ 
  new MyClass().print();} %&gt;
  </code></pre>
  
  <p>there is any way more easy? or this is the right way for to do?</p>
  
  <p>ps: I dont want to use javascript</p>
  
  <p>edit: My class just have a method "print",that prints something like "test" in system.out.println</p>