How do I import an interface into a JSP file ?
843836Jul 13 2003 — edited Jul 14 2003Hello,
I want to import an interface into my JSP file
The interface is:
<code>
import java.sql .*;
public interface DatabaseConnection
{
public void open() throws ClassNotFoundException, SQLException;
public void close() throws SQLException;
public ResultSet query(String query) throws SQLException;
public boolean execute(String query) throws SQLException;
}
</code>
And the jsp is this :
<code>
<%@ page import="java.sql .*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import= "photoMaster.*" %>
<%
// Connect to the database.
DatabaseConnection database = new MySQLDatabaseConnection(Globals.USERNAME, Globals.PASSWORD, Globals.SERVER_URL, Globals.DATABASE);
</code>
I'm getting this error :
<code>
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:\Tomcat\work\Standalone\localhost\david\Photos_jsp.java:62: cannot access photoMaster.DatabaseConnection
[javac] bad class file: C:\Tomcat\webapps\david\WEB-INF\classes\photoMaster\DatabaseConnection.class
[javac] class file contains wrong class: DatabaseConnection
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] photoMaster.DatabaseConnection database = new photoMaster.MySQLDatabaseConnection(Globals.USERNAME, Globals.PASSWORD, Globals.SERVER_URL, Globals.DATABASE);
[javac] ^
[javac] 1 error
</code>
Does anyone know how I can import this interface ?