title: How to write methods inside JSP and call them?
body: <p>Following is my jsp code. I'm new to JSP. I get the error shown after the code</p>
  
  <pre><code>&lt;body&gt;
  &lt;%!
      public ArrayList&lt;ArrayList&lt;Leg&gt;&gt; trip;
      public void routeManager(){
          Location stLoc = new Location(60.2040521,24.96185113,"1023");
          Location endLoc = new Location(60.17936316, 24.92282214 ,"1130");
          RouteRetriever hrr = new RouteRetriever();
          trip = hrr.getRoutes(stLoc, endLoc, false);
      }
  %&gt;
  &lt;%  routeManager();
      System.out.println("Im here AA");%&gt;
  &lt;%= out.println("Hello World:"+hrr.size()) %&gt;
  &lt;p&gt;Booooooooooooo!&lt;/p&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>An error occurred at line: 30 in the jsp file: /index.jsp
  The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
  </code></pre>