[英]HTTP Status 404 - Not Found Glassfish on JSP
我是Java的初学者,并且正在处理一些小项目。 我有个问题。 当我想通过某种方法通过链接打开JSP页面时,出现此错误:
HTTP状态404-找不到类型状态报告消息未找到描述请求的资源不可用。 GlassFish Server开源版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>
我的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.