[英]Java Web Application Return Error HTTP 404 Not Found
我正在用netbeans學習Java。 我構建用於插入,更新和刪除操作的Web應用程序。 但是當我運行該應用程序時,它始終返回未找到錯誤404。
這是我要運行的HTML代碼。
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Add New</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Add New</h1>
<div style="width: 900px; margin-left: auto; margin-right: auto">
<form action="JSP/ManagerAddNew.jsp" method="post">
Title:<br>
<input type="text" name="title" style="width: 200px"><br>
Description:<br>
<input type="text" name="description" style="width: 200px"><br>
Detail:<br>
<textarea name="detail" style="width: 400px; height: 200px"></textarea><br>
Category:
<select name="category">
<option value="World">World</option>
<option value="Tech">Tech</option>
<option value="Sport">Sport</option>
</select><br>
Image:<br>
<input type="text" name="image" style="width: 200px"><br>
<input type="submit" value="Submit">
</form>
<!--Complete Interface Addnew.-->
</div>
</body>
</html>
這是我的項目結構。
我不了解GlassFish Server,但是tomcat。 URL不能直接訪問WEB-INF文件夾下的JSP文件,您可以這樣訪問:
request.getRequestDispatcher(“/WEB-INF/xxx.jsp”).forward(request,response);
我不確定這種方式是否可以解決GlassFish下的問題,希望它可以為您提供幫助。
每當我遇到此類錯誤時,都必須重新安裝glassfish模塊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.