0

我有一个包含三个文件的 Java EE 项目delete.jspindex.jsp并且BooksWorker.java.

在这里我无法运行index.jsp,即使我放置BooksWorker.class在 WEB-IN/classes 中。我得到的错误:


type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 24 in the jsp file: /index.jsp BooksWorker cannot be resolved 21: String remark = request.getParameter("remark"); 22: if (author != null && title != null 23: && year != null && remark!= null) { 24: BooksWorker.Insert(author, title, year, remark); 25: } 26: %> 27:

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:356) org.apache.jasper.compiler.Compiler.compile(Compiler.java:334) org.apache.jasper.compiler.Compiler.compile(Compiler.java:321) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328) 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)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.36 logs.

4

2 回答 2

1

尝试将BooksWorker类从未命名包移动到命名包。JSP 编译器无法访问 [未命名包] 中的类。

于 2012-11-19T23:55:39.450 回答
0

该错误很可能是由于未在 jsp 中导入 BooksWorker。

<%@page import="<package name>.BooksWorker"%>
于 2012-11-20T00:03:38.140 回答