title: How to call Java class in Jsp
body: <p>Hi i am trying to call regular java class  in jsp page and want to print some on jsp page   when i am trying to do i am not getting any output </p>
  
  <p>Here is my code</p>
  
  <p>MyClass.java</p>
  
  <pre><code> package Demo;
   public class MyClass {
      public void testMethod(){
          System.out.println("Hello");
      }
   }
  </code></pre>
  
  <p>test.jsp</p>
  
  <pre><code>&lt;%@ page import="Demo.MyClass"%&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;jsp:useBean id="test" class="Demo.MyClass" /&gt;
    &lt;%
     MyClass tc = new MyClass();
     tc.testMethod();
    %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How can I get my desired output?</p>