title: Adding a java class file in an another java class file
body: <p>I am doing a jsp project in which, I have a dbconn.java page in which database connection to MySQL database is created.</p>
  
  <p>I want to call it in an another java page for getting the database connection.</p>
  
  <p>I dont know how to include the page dbconn.java into my page. Please help.</p>
  
  <p>I know its a simple question for you all, but I could not find the answer.</p>
  
  <pre><code>import com.opensymphony.xwork2.ActionSupport;
  import com.opensymphony.xwork2.ActionContext;
  import java.util.*;
  import java.util.Date;
  import java.sql.*;
  package com.act;
  
  public class dbconn {
  
  
       public String execute() throws Exception 
        {
            Connection con=null;
            Statement stmt1=null;
            Class.forName("com.mysql.jdbc.Driver");
            con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabasename", "root", "password");     
        }
  }
  </code></pre>
  
  <p>This is my dbconn.java page. Is this correct?</p>