我刚刚开始研究JSP,如果只有一个JSP文件就可以了。
我创建了一个用于测试JavaBeans的类文件,并始终收到错误“无法编译JSP类”和Web状态500.
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [9] in the jsp file: [/index.jsp]
person cannot be resolved to a type
---------------------------- The 'person'.class code ------------
import java.lang.*;
public class person {
private String name;
private int age;
private String sex;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
------------------------- The JSP file -------------------------
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>Java Bean Actions</title>
</head>
<body><br/>
<jsp:useBean id="person" class="person" scope="page"></jsp:useBean>
<jsp:setProperty name="person" property="*" />
答案 0 :(得分:1)
原因是您的SELECT * from xyz WHERE time IN (SELECT time from xyz WHERE unit = 'some-unit')
班级位于person
个文件夹。您的bean src
必须具有包声明。
可以在 Unable to compile this class for JSP 找到更多详细信息。
顺便说一下,把你的课命名为person
是一个坏主意,它应该以大写字母开头,如person