I'm quite new to tomcat and JSP in general, I also have searched countless other questions that appear to have the exactly same problem but none solved my problem.
the server structure contains (amongst other things like a css file and other html ressources) a jsp file and a java class:
.../webapps/[appname]/test.jsp
.../webapps/[appname]/WEB-INF/classes/beans/Bean.class
the jsp file contains:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import = "beans.Bean" %>
<html>
<head>
<link href="css.css" rel="stylesheet" type="text/css">
<title>title</title>
<meta charset="utf-8">
</head>
<body>
<%= new String((new beans.Bean()).foo())%>
</body>
</html>
And the source file for the Java class looks like so:
package beans;
public class Bean {
public String foo() {
return "Success";
}
}
Now I (re)start the tomcat server and access the jsp file with my browser and get the follwong error message:
Unable to compile class for JSP: An error occurred at line: 14 in the generated java file Only a type can be imported. beans.Bean resolves to a package
As well as:
An error occurred at line: 10 in the jsp file: /tilt.jsp beans.Bean cannot be resolved to a type
By changing the import like so:
<%@ page import = "beans.*" %>
And then restarting tomcat before trying again, I can remove the first error, but the type of my class is still not recognized. What do I need to do in order to make this simple project work?
I believe I'm using tomcat7.something and the class files were compiled with java jre 7.