【问题标题】:HTTP Status 404 - Not Found Glassfish on JSPHTTP 状态 404 - 在 JSP 上未找到 Glassfish
【发布时间】:2016-12-02 08:34:03
【问题描述】:

我是 java 初学者,我正在处理一些小项目。我有个问题。当我想通过链接以某种方法打开 JSP 页面时,出现此错误:

HTTP 状态 404 - 未找到 类型状态报告 未找到信息 描述请求的资源不可用。 GlassFish Server 开源版 4.1

(books.jsp 在“pages”目录中。)

谢谢你们。

这是我的代码: 这是链接代码:

**

<div class="left_bar">
    <h4>Genres:</h4>
    <ul class="nav">
        <jsp:useBean id="genreList" class="ua.web.first.GenreList" scope="application"/>
        <%
            for (Genre genre : genreList.getGenreList()) {
        %>
        <li><a href="../../pages/books.jsp?genre_id=<%=genre.getId()%>&name=<%=genre.getName()%>"><%=genre.getName()%></a></li>
        <%}%>
    </ul>
</div>

**

这里是 books.jsp:

<%@include file="../WEB-INF/jspf/left_bar.jspf" %>
<%request.setCharacterEncoding("UTF-8");
    long genreId = 0L;
    try {
        genreId = Integer.valueOf(request.getParameter("genre_id"));
    } catch (Exception exception1) {
        System.out.println("error");
        exception1.printStackTrace();
    }
%>

<jsp:useBean id="bookList" class="ua.web.first.BookList" scope="page"/>

<dic class="book_list">
    <h3><%request.getParameter("name");%></h3>
    <table cellpadding="30" style="font-size: 12px">

        <%
            for (Book book : bookList.getBooksByGenre(genreId)) {
        %>
        <tr>
            <td style="width:400px; height: 100px;">
                <p style="color:blueviolet; font-weight: bold;font-size: 15px;"><% book.getName();%></p>
                <br><strong>Isbn:</strong> <% book.getIsbn(); %>
                <br><strong>Publisher</strong> <% book.getPublisher();%>
                <br><strong>Page count</strong> <% book.getPageCount(); %>
                <br><strong>Publish year</strong><% book.getDate(); %>
                <br><strong>Author</strong> <% book.getAuthor(); %>
                <p style="margin: 10px;"><a href="#">Read</a></p>
            </td>
            <td style="width: 150px; height: 100px">
                image
            </td>
        </tr>
        <%}%>
    </table>
</div>

【问题讨论】:

  • 你的 index.jsp 怎么样?

标签: java jsp netbeans aero-glass


【解决方案1】:

我的 index.jsp 还没有完成,但它可以工作

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Welcome page</title>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
    </head>
    <body>
        <div></div>
        <div class="index_conteiner">
            <p class="text">Welcome to our library</p>
             <form class="form" action="pages/main.jsp" method="POST">
            <input type="text" name="username" value="" size="30" />
            <input type="submit" value="Enter" />
        </form>
        </div>
    </body>
</html>

【讨论】:

    猜你喜欢
    • 2015-12-09
    • 1970-01-01
    • 2019-07-30
    • 2016-03-25
    • 2020-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-30
    相关资源
    最近更新 更多