I'm just playing around with JSP. I just wanted to test some <jsp:useBean>
stuff, but I can't. Every time if I'm using <jsp:useBean>
, I get an error. Even if I just have this, I get an error:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body>
<jsp:useBean id="mybean" class="Users" scope="session" >
<jsp:setProperty name="mybean" property="name" value="Hello world" />
</jsp:useBean>
</body>
</html>
Without the <jsp:useBean>
it runs fine. With the <jsp:useBean>
I get an error like:
Servlet.service() for servlet [jsp] in context with path [/JSPTest] threw exception [Unable to compile class for JSP:
An error occurred at line: 10 in the jsp file: /index.jsp
Users cannot be resolved to a type
7: <title>Insert title here</title>
8: </head>
9: <body>
10: <jsp:useBean id="mybean" class="Users" scope="session" >
11: <jsp:setProperty name="mybean" property="name" value="Hello world" />
12: </jsp:useBean>
13: </body>
I am using Eclipse, Tomcat 7.0.23 and Java 1.7.0_01.
Any ideas?
PS: I had to change the port 8xxx to 9xxx because the oracle DB is using the standard 8xxx. But that's likely not the cause of the problem.