title: out.print() is not working with jsp method
body: <p><code>out object</code> shows error like cannot find symbol. Tried many ways to fix the error. But it stil shows error</p>
  
  <pre><code>&lt;%@ page import="java.sql.*" %&gt;
  &lt;%!
      void loadBuilding() throws Exception {
          Class.forName("com.mysql.jdbc.Driver");
          Connection con = DriverManager.getConnection("jdbc:mysql://localhost/crm", "root", "");
          Statement st = con.createStatement();
          ResultSet rs = st.executeQuery("select name from building where 1");
          rs.last();
          int count = rs.getRow();
          if (count &gt; 0) {
              rs.beforeFirst();
              while (rs.next()) {
                  out.print("&lt;script&gt;passName('" + rs.getString(1) + "');&lt;/script&gt;");
              }
          } else {
              out.print("No Buildings Added Yet");
          }
      }
  %&gt;
  
  &lt;%
      loadBuilding();
  %&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/tMAdV.png" alt="out.print() shows error"></p>