Dean_Grobler 48 Posting Whiz in Training

Hello there,

I am trying to access Array elements in another class within my JSP and then parsing them into <select> tags. I'm getting 2 errors though stating that it cannot find the class "PopulateMainScr".

Here is my PopulateMainScr class:

package ContactKeeper;

import java.sql.*;
import java.util.*;

public class PopulateMainScr {

	public static String[] getArray(){

		//DataBase Properties
		String JDBCdriver = "sun.jdbc.odbc.JdbcOdbcDriver";
		String DBname = "ContactDataBase";
		String DBUrl = "jdbc:odbc:ContactDataBase";
		ArrayList al = new ArrayList();

			//Load DataBase Driver
		catch(ClassNotFoundException c){
			System.out.println("An error Occured while loading DataBase Driver: "+c.getMessage());

			//Connect to DataBase
			Connection con = DriverManager.getConnection(DBUrl);

			//Create Statement Object
			Statement stmt = con.createStatement();

			//Create ResultSet
			ResultSet rs = stmt.executeQuery("SELECT * FROM Contacts");

			//SQL Queries and adding to ArrayList

					String combo = (rs.getString("Name")+" "+rs.getString("Surname"));
			catch(SQLException q){
				System.out.println("A SQL exception occured while trying to read data from database: "+q.getMessage());

		catch(SQLException s){
			System.out.println("And SQL Exception occured: "+s.getMessage());

		//Convert ArrayList to Array
		int arrayListSize = al.size();
		String []contactArray = new String[arrayListSize];

		return contactArray;



And here is my JSP Page:

<!-- the NewContact Screen -->
<link rel="stylesheet" type="text/css" href="PageStyle.css" />

<script language"JavaScript">
function goNewContact() {
	//URL for button to follow

function goViewContact() {
	//URL for button to follow



<img src="Images/Header.png">


	<input type="button" value="Search"/>
	<input type="text" name="Search Query" />


	<!-- Contact List on the MainScreen -->
	<select style="width: 210px; height: 200px" name="contactName" multiple>
	String[] myArray = ContactKeeper.PopulateMainScr.getArray(); 
	for(int i =0; i < myArray.length(); ++i){
	<option value="<%= myArray[i] %>" >
	<%= myArray[i] %>

	<td><input type="button" value="View Contact" onclick="goViewContact()" >
	<td><input type="button" value="Delete Contact"/></br>

	<td><input type="button" value="New Contact" onclick="goNewContact()" >




I don't know if this has anything to do with import statements, although the tutorials I've read that does something similiar to this doesn't make use of import statements at all. Also I don't know if this might have something to do with my CLASSPATH?

I'm using Tomcat so the the actual JSP page is located under ROOT\ContactKeeper/ and my PopulateMainScr class is located under ROOT\WEB-INF\classes\

Thanks for any help!