简体   繁体   中英

HTTP Status 404 - Not Found Glassfish on JSP

Im beginner in the java, and im working with some small project. I have a problem. When i want to go through the link to open a JSP page with some method i got this error:

HTTP Status 404 - Not Found type Status report messageNot Found descriptionThe requested resource is not available. GlassFish Server Open Source Edition 4.1

(books.jsp is in "pages" directory.)

thank you guys.

Here is my code: this is the link code:

**

<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>

**

and here is the 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>

my index.jsp is not finished, but it works

<%@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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM