I am getting an exception in Tomcat stating the following:
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 6 in the generated java file Only a type can be imported. business.User resolves to a package An error occurred at line: 12 in the jsp file: /join_email_list.jsp User cannot be resolved to a type 9: <body> 10: <%@ page import="business.User" %> 11: <% 12: User user = (User) request.getAttribute("user"); 13: String message = (String) request.getAttribute("message"); 14: 15: if (user == null) An error occurred at line: 12 in the jsp file: /join_email_list.jsp User cannot be resolved to a type 9: <body> 10: <%@ page import="business.User" %> 11: <% 12: User user = (User) request.getAttribute("user"); 13: String message = (String) request.getAttribute("message"); 14: 15: if (user == null) An error occurred at line: 17 in the jsp file: /join_email_list.jsp User cannot be resolved to a type 14: 15: if (user == null) 16: { 17: user = new User(); 18: } 19: if (message == null) 20: { 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:349) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592) 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) A few things to point out:
First:
An error occurred at line: 6 in the generated java file Only a type can be imported. business.User resolves to a package This is inaccurate User is a class in the business package.
Second
User user = (User) request.getAttribute("user"); User is clearly a type, in NetBeans ctrl + space brings up all the class properties and methods.
Here is the User class:
package business; public class User { private String firstName; private String lastName; private String emailAddress; public User() { firstName = ""; lastName = ""; emailAddress = ""; } public User(String first, String last, String email) { firstName = first; lastName = last; emailAddress = email; } public void setFirstName(String f) { firstName = f; } public String getFirstName() { return firstName; } public void setLastName(String l) { lastName = l; } public String getLastName() { return lastName; } public void setEmailAddress(String e) { emailAddress = e; } public String getEmailAddress() { return emailAddress; } } How can I resolve this? It doesn't seem as if anything is wrong. Thanks.
business.User.Something