I have a jsp file that imports from my package folder inside my classes directory. When I try to use it, i get the "Unable to compile" and "cannot be resolved to a type" errors. Here are my code.
<%@ page language="java" import="cs5530.*" %>
<html>
<head>
<script type="text/javascript">
function showInvalid()
{
document.getElementById("invalid").style.display = 'block';
document.getElementById("loginForm").reset();
}
</script>
</head>
<body>
<p>Welcome to FlixNet. Sign In</p>
<form name="loginForm" method="post" action="index.jsp">
User Name: <input type="text" name="username"><br>
Password: <input type="Password" name="password"><br>
<input type="submit" value="Submit">
<div id="invalid" style="display:none">
<p>Invalid username or password</p>
</div>
</form>
<%
Connector con = new Connector();
con.closeConnection();
%>
</body>
</html>
this is the error
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 23 in the jsp file: /index.jsp
Connector cannot be resolved to a type
20: </div>
21: </form>
22: <%
23: Connector con = new Connector();
24: con.closeConnection();
25: %>
26: </body>
An error occurred at line: 23 in the jsp file: /index.jsp
Connector cannot be resolved to a type
20: </div>
21: </form>
22: <%
23: Connector con = new Connector();
24: con.closeConnection();
25: %>
26: </body>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
this is my file structure
public_html
index.jsp
|WEB-INF
|classes
mysql.jar
|cs5530
Connector.java
Connector.class
other java and class files.
my Connector class is under the package cs5530 so that isn't the issue. The connector class is a simple db connector class that I have tested and it works.