HTTP状态404 - 未找到JSP上的Glassfish

问题描述:

在Java中我是初学者,并且正在使用一些小型项目。我有个问题。当我想通过该链接打开一个JSP页面的一些方法,我得到这个错误:HTTP状态404 - 未找到JSP上的Glassfish

HTTP状态404 - 找不到 类型状态报告 messageNot找到 descriptionThe请求的资源不可用。 GlassFish应用服务器版4.1

(books.jsp在 “页面” 目录。)

感谢你们。

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

**

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

你的index.jsp怎么样? –

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