I have created an EE project in MyEclipse.
I have one jsp file under "WebRoot" and it contains the following lines:
<%@ page language="java" import="java.util.*,java.sql.*,com.sp.model.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<%
String username=request.getParameter("username");
String password=request.getParameter("passwd");
UserBeanCL ubc=new UserBeanCL();
%>
...
and I have also created a package called com.sp.model under "src" in MyEclipse.As you can see from the first line of the JSP code above, I have imported that package using import statement.UserBeanCL is just a normal JAVA class sits under that package, nothing special. Everything looks good in MyEclipse.It does find the package and the UserBeanCL class.
However, after I deployed the whole site into Tomcat and try run this JSP in browser, it always gives error and complains about line:
UserBeanCL ubc=new UserBeanCL();
The error is like: "UserBeanCL cannot be resolved to a type". The stacktrace is:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
This error is confusing to me, since it only appears after deployment. Could experts help me on where to debug? Thanks in advance.
Use:
<%@ page language="java" import="java.util.*,java.sql.*,com.sp.model.*" pageEncoding="ISO-8859-1"%>
Regards;