简体   繁体   English

HTTP状态404-在JSP上找不到Glassfish

[英]HTTP Status 404 - Not Found Glassfish on JSP

Im beginner in the java, and im working with some small project. 我是Java的初学者,并且正在处理一些小项目。 I have a problem. 我有个问题。 When i want to go through the link to open a JSP page with some method i got this error: 当我想通过某种方法通过链接打开JSP页面时,出现此错误:

HTTP Status 404 - Not Found type Status report messageNot Found descriptionThe requested resource is not available. HTTP状态404-找不到类型状态报告消息未找到描述请求的资源不可用。 GlassFish Server Open Source Edition 4.1 GlassFish Server开源版4.1

(books.jsp is in "pages" directory.) (books.jsp在“页面”目录中。)

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: 这是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 我的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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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