title: How to display Java Multi threading output in jsp file
body: <p>I have a Java Program which contains my own thread (start() and run() methods). Code is shown below :</p>
  
  <pre><code>public class MyClass
  {
      public void threadStart()
      {
          Threadone t1 = new Threadone();
          t1.start();
      }
  
  }
  class Threadone extends Thread
  {
      public void run()
      {
          String url = "jdbc:mysql://localhost:3306";
          String user= "root";
          String pwd = "root@123";
          String qry = "SELECT Country FROM test.abuse WHERE Priority='High'";
          Connection conn = null;
          try 
          {
              Class.forName("com.mysql.cj.jdbc.Driver");
              conn = DriverManager.getConnection(url, user, pwd);
  
              ResultSet rs = conn.prepareStatement(qry).executeQuery();
  
              while(rs.next())
              {
                  System.out.println(rs.getString("Country"));
              }
          } 
          catch (SQLException | ClassNotFoundException e) 
          {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p><strong>JSP File:</strong></p>
  
  <pre><code> &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;%
          MyClass my = new MyClass();
          my.threadStart();
      %&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>As of now I am displaying the result in java console. But my task is to display the result in jsp file, Is it possible? If possible how to print the data in webpage using jsp file?</p>