gpt4 book ai didi

java - 无法为 JSP : BooksWorker cannot be resolved 编译类

转载 作者:行者123 更新时间:2023-11-28 23:03:51 25 4
gpt4 key购买 nike

我有一个 Java EE 项目,其中包含三个文件 delete.jspindex.jspBooksWorker.java

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


type Exception report<p></p>

<p>message Unable to compile class for JSP:</p>

<p>description The server encountered an internal error that prevented it from fulfilling this request.</p>

<p>exception</p>

<p>org.apache.jasper.JasperException: Unable to compile class for JSP: </p>

<p>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: </p>

<p>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)</p>

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

最佳答案

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

关于java - 无法为 JSP : BooksWorker cannot be resolved 编译类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13464231/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com