无法为JSP编译类:HTTP状态500

时间:2017-11-28 07:42:02

标签: java jsp

我的项目有tomcat 8,JDK7和我的服务器有tomcat 7。

登录管理页面后,我遇到以下错误。但是在我的笔记本电脑上运行良好。

org.apache.jasper.JasperException:无法为JSP编译类:

An error occurred at line: [15] in the generated java file: [/usr/local/easy/share/easy-tomcat7/work/Catalina/homecab.net/admin/org/apache/jsp/manager_005fcategory_jsp.java]
Only a type can be imported. model.Category resolves to a package

An error occurred at line: [18] in the generated java file: [/usr/local/easy/share/easy-tomcat7/work/Catalina/homecab.net/admin/org/apache/jsp/manager_005fcategory_jsp.java]
Only a type can be imported. dao.CategoryDAO resolves to a package

An error occurred at line: 23 in the jsp file: /manager_category.jsp
CategoryDAO cannot be resolved to a type
20:     </head>
21:     <body>
22:         <%
23:             CategoryDAO categoryDAO = new CategoryDAO();
24:         %>
25: 
26:         <jsp:include page="header.jsp"></jsp:include>

An error occurred at line: 23 in the jsp file: /manager_category.jsp
CategoryDAO cannot be resolved to a type
20:     </head>
21:     <body>
22:         <%
23:             CategoryDAO categoryDAO = new CategoryDAO();
24:         %>
25: 
26:         <jsp:include page="header.jsp"></jsp:include>


An error occurred at line: 46 in the jsp file: /manager_category.jsp
Category cannot be resolved to a type
43: 
44:                     <%
45:                         int count = 0;
46:                         for (Category category : categoryDAO.getListCategory()) {
47:                             count++;
48:                     %>
49:                     <tr class="data">

Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:463)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

并且有manager_category.jsp

 <%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="model.Category, java.util.*, java.io.*" %>
<%@page import="dao.CategoryDAO, java.util.*, java.io.*" %>
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>manager category</title>

        <link href="../css/mos-style.css" rel="stylesheet" type="text/css" media="all" /> 

    </head>
    <body>
        <%
            CategoryDAO categoryDAO = new CategoryDAO();
        %>

    <jsp:include page="header.jsp"></jsp:include>

        <div id="wrapper">

        <jsp:include page="menu.jsp"></jsp:include>
            <div id="rightContent">
                <h3>Quản lý thể loại</h3>

                <a href="../admin/insert_category.jsp">Thêm thể loại</a>

                <table id="datatable-buttons"  class="data table-striped"  >
                    <tr class="data">
                        <th class="data" width="30px">STT</th>
                        <th class="data">Mã Thể Loại</th>
                        <th class="data">Tên Thể Loại</th>
                        <th class="data" width="90px">Tùy Chọn</th>
                    </tr>

                <%
                    int count = 0;
                    for (Category category : categoryDAO.getListCategory()) {
                        count++;
                %>
                <tr class="data">
                    <td class="data" width="30px"><%=count%></td>
                    <td class="data"><%=category.getCategoryID()%></td>
                    <td class="data"><%=category.getCategoryName()%></td>
                    <td class="data" width="90px">
                <center>
                    <a href="../admin/update_category.jsp?command=updateCategory&category_id=<%=category.getCategoryID()%>">Sửa</a>&nbsp;&nbsp; | &nbsp;&nbsp;
                    <a href="/shop/ManagerCategoryServlet?command=deleteCategory&category_id=<%=category.getCategoryID()%>">Xóa</a>
                </center>
                </td>
                </tr>
                <%}%>
            </table>
        </div>
        <div class="clear"></div>

        <jsp:include page="footer.jsp"></jsp:include>

    </div>
</body>

请告诉我发生了什么事!我是进口的

<%@page import="model.Category, java.util., java.io." %> <%@page import="dao.CategoryDAO, java.util., java.io." %>

我将在堆栈上搜索一些相同的问题,但我无法解决它。请帮帮我,谢谢大家。

0 个答案:

没有答案