有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java JSP已编译,但现在有几个错误?

我在github上有一个JSP和Servlet项目,位于-https://github.com/double-whammy/affablebean.git。这段代码至少在我的旧电脑上编译正确了。当我把它导入我的新电脑时,它显示了很多奇怪的编译错误。我将向您展示一些代码和错误。请帮我纠正一下

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/affablebean.css">
<title>The Affable Bean</title>
</head>
<body>

    <sql:query var="categories" dataSource="jdbc/affablebean">
    SELECT * FROM category
    </sql:query>

    <sql:query var="selectedCategory" dataSource="jdbc/affablebean">
    SELECT name FROM category WHERE id = ?
    <sql:param value="${pageContext.request.queryString}" />
    </sql:query>

    <sql:query var="categoryProducts" dataSource="jdbc/affablebean">
    SELECT * FROM product WHERE category_id = ?
    <sql:param value="${pageContext.request.queryString}" />
    </sql:query>

    <div id="categoryLeftColumn">

        <c:forEach var="category" items="${categories.rows}">

            <c:choose>
                <c:when test="${category.id == pageContext.request.queryString}">
                    <div class="categoryButton" id="selectedCategory">
                        <span class="categoryText"> ${category.name} </span>
                    </div>
                </c:when>
                <c:otherwise>
                    <a href="category?${category.id}" class="categoryButton">
                        <div class="categoryText">${category.name}</div>
                    </a>
                </c:otherwise>
            </c:choose>

        </c:forEach>

    </div>
</body>
</html>

错误是:

<sql:param value="${pageContext.request.queryString}" />行:

Multiple annotations found at this line:
    - java.io.IOException cannot be resolved to a type
    - No exception of type ServletException can be thrown; an exception type must be a subclass of 
     Throwable
    - The method getQueryString() from the type HttpServletRequest refers to the missing type String
    - String cannot be resolved to a type

<sql:query var="categoryProducts" dataSource="jdbc/affablebean">

No exception of type JspException can be thrown; an exception type must be a subclass of Throwable

<c:forEach var="category" items="${categories.rows}">

Multiple annotations found at this line:
    - java.util.Map cannot be resolved 
     to a type

共 (0) 个答案