troubleshooting Question

Beans files errors

Avatar of timjg
timjg asked on
JSP
101 Comments1 Solution1070 ViewsLast Modified:
This is Error Compiling JSP File  - part 2

Kennethxu's solution worked.  Thank you.  Now when I compile it shows errors in my two beans java files.  Immediately below are the generated errors and I will follow with the two java files.  Thanks for any help you can provide..

trackingView$jsp.java [86:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingView$jsp
                TrackingDataBean trackingData = null;
                ^
trackingView$jsp.java [89:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingView$jsp
                    trackingData= (TrackingDataBean)
                                   ^
trackingView$jsp.java [94:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingView$jsp
                            trackingData = (TrackingDataBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TrackingDataBean");
                                            ^
trackingView$jsp.java [142:1] cannot resolve symbol
symbol  : class TrackingBean
location: class org.apache.jsp.trackingView$jsp
                        TrackingBean tracking;
                        ^
trackingView$jsp.java [145:1] cannot resolve symbol
symbol  : class TrackingBean
location: class org.apache.jsp.trackingView$jsp
                            tracking = ( TrackingBean ) trackingListIterator.next();
                                         ^
trackingLogin$jsp.java [79:1] cannot resolve symbol
symbol  : class TrackingBean
location: class org.apache.jsp.trackingLogin$jsp
                TrackingBean tracking = null;
                ^
trackingLogin$jsp.java [82:1] cannot resolve symbol
symbol  : class TrackingBean
location: class org.apache.jsp.trackingLogin$jsp
                    tracking= (TrackingBean)
                               ^
trackingLogin$jsp.java [87:1] cannot resolve symbol
symbol  : class TrackingBean
location: class org.apache.jsp.trackingLogin$jsp
                            tracking = (TrackingBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TrackingBean");
                                        ^
trackingLogin$jsp.java [106:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingLogin$jsp
                TrackingDataBean trackingData = null;
                ^
trackingLogin$jsp.java [109:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingLogin$jsp
                    trackingData= (TrackingDataBean)
                                   ^
trackingLogin$jsp.java [114:1] cannot resolve symbol
symbol  : class TrackingDataBean
location: class org.apache.jsp.trackingLogin$jsp
                            trackingData = (TrackingDataBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TrackingDataBean");
                                            ^

11 errors
Errors compiling trackingLogin

The two .java files follow:

// TrackingBean.java
// JavaBean to store branch sales data for a database

public class TrackingBean {

    private String branch, year, month, day;
    // private int
   
    // set the branch's name
    public void setBranch ( String name )
    {
        branch = name;
    }
   
    // get the branch's name
    public String getBranch()
    {
        return branch;
    }    
   
    // set the branch's year
    public void setYear ( String yyyy )
    {
        year = yyyy;
    }
   
    // get the branch's year
    public String getYear()
    {
        return year;
    }
   
    // set the branch's month
    public void setMonth ( String mm )
    {
        month = mm;
    }
   
    // get the branch's month
    public String getMonth()
    {
        return month;
    }    
   
    // set the branch's day
    public void setDay ( String dd )
    {
        day = dd;
    }
   
    // get the branch's day
    public String getDay()
    {
        return day;
    }
   
}


// TrackingDataBean.java
// Class TrackingDataBean makes a database connection and supports
// inserting and retrieving data from the database/


// Java core packages
import java.sql.*;
import java.io.*;
import java.util.*;


public class TrackingDataBean {
  private Connection connection;
  private PreparedStatement addRecord, getRecords;
  private Statement stat;
   
  // construct TitlesBean object
  public TrackingDataBean() throws Exception
  {
      //System.setProperty( "
     
      // load the Ability driver
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
     
      // connect to the database
      connection = DriverManager.getConnection(
          "jdbc:odbc:Tracking" );
         
      //Statement stat=con.createStatement();
      //Statement stat=connection.createStatement();
      stat = connection.createStatement();
  }
 
  // return an ArrayList of TrackingBeans
  public ArrayList getTrackingList() throws SQLException
  {
      ArrayList trackingList = new ArrayList();
     
      // obtain list of titles
     
       
      ResultSet results = stat.executeQuery(
          "SELECT branch, year, month, day FROM Tracking" );
         
         
     
      // get row data
      while ( results.next() ) {
          TrackingBean tracking = new TrackingBean();
         
          tracking.setBranch( results.getString( 1 ) );
          tracking.setYear( results.getString( 2 ) );
          tracking.setMonth( results.getString( 3 ) );
          tracking.setDay( results.getString( 4 ) );
         
          trackingList.add( tracking );
      }
     
      return trackingList;
     
  }
 
  // insert a branch's tracking in tracking database
  public void addTracking( TrackingBean tracking ) throws SQLException
  {
      stat.executeUpdate( "INSERT INTO tracking ( branch, " +
      "year, month, day ) VALUES ( '" + tracking.getBranch() + "', '" +
      tracking.getYear() + "', '" + tracking.getMonth() + "', + '" +
      tracking.getDay() + "' )" );
  }    
   
  // close statemetns and terminate database connection
  protected void finalize()
  {
      // attempt to close database connection
      try {
          stat.close();
          connection.close();
      }
     
      // process SQLException on close operation
      catch ( SQLException sqlException ) {
          sqlException.printStackTrace();
      }
  }  

}

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 101 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 101 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros