Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I import an interface into a JSP file ?

843836Jul 13 2003 — edited Jul 14 2003
Hello,

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 ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2003
Added on Jul 13 2003
3 comments
354 views