为什么JSP中的void构造函数返回错误?

时间:2020-08-26 02:11:12

标签: java jsp

这是主要代码

<%@page import="Escola.Disciplina"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            Disciplina disciplina = new Disciplina();
        %>
   
    </body>
</html>

那是我要实例化的类。从字面上看,什么都没有

package Escola;

public class Disciplina {   
    public Disciplina(){
        
    }
}

但是当我尝试跑步时,出现了那个东西

java.lang.RuntimeException: 
    Escola.Disciplina.<init>(Disciplina.java:1)
    org.apache.jsp.salvarDisciplina_jsp._jspService(salvarDisciplina_jsp.java:96)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

当我单击以在检查器中查看时,他们说错误在Disciplina类的第1行“ Escola软件包”中。你们知道为什么会这样吗?

0 个答案:

没有答案