0
我正在開發一個Web應用程序,但是當我嘗試運行welcome.html並單擊AddActor按鈕時,它將指向一個將數據發佈到servlet的。當我試圖運行我收到此錯誤,請幫我出我收到「請求的資源不可用」404錯誤
我與STS,Tomcat的8,Maven的web應用程序
的工作和我的目錄結構如下
welcome.html
<!doctype html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Film Management System</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="login.css">
<script type="text/javascript" src="../script/angular.min.js"></script>
<script type="text/javascript" src="../script/angular-route.min.js">></script>
<script type="text/javascript" src="../script/appConfig.js"></script>
<script type="text/javascript" src="../script/appCtrl.js"></script>
</head>
<body ng-app="myApplication">
<img src='../static/bg.png' width="1280" height="222"/>
<div ng-controller="myCtrl">
<a href="#/AddNewFilm" class="addfilm_buttton button1" ng-click="action.addFilm()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Add film</a>
<a href="#/ModifyFilm" class="modifyfilm_buttton button1" ng-click="action.modifyFilm()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Modify Film</a>
<a href="#/ModifyFilm" class="searchfilm_buttton button1" ng-click="action.searchFilm()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Search Film</a>
<a href="#/ModifyFilm" class="removefilm_buttton button1" ng-click="action.removeFilm()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Remove Film</a>
<a href="ViewAllFilms.html" class="viewallfilms_buttton button1" ng-click="action.getAllFilms()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">View All Films</a>
<a href="#/AddNewActor" class="addactor_buttton button1" ng-click="action.addActor()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Add Actor</a>
<a href="#/ModifyActor" class="modifyactor_buttton button1" ng-click="action.modifyActor()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Modify Actor</a>
<a href="#/SearchActor" class="searchactor_buttton button1" ng-click="action.searchActor()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Search Actor</a>
<a href="#/RemoveActor" class="removeactor_buttton button1" ng-click="action.removeActor()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Remove Actor</a>
<a href="ViewAllActors.html" class="viewallactors_buttton button1" onclick="return submitMyForm();" ng-click="action.getAllActors()" ng-hide="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">View All Actors</a>
<a href="#/" class="show_buttton button1" ng-click="showButtons()" ng-show="action.buttonClicked.addFilm || action.buttonClicked.modifyFilm || action.buttonClicked.searchFilm || action.buttonClicked.removeFilm || action.buttonClicked.getAllFilms || action.buttonClicked.addActor || action.buttonClicked.modifyActor || action.buttonClicked.searchActor || action.buttonClicked.removeActor || action.buttonClicked.getAllActors">Home</a>
<div ng-view></div>
</div>
</body>
</html>
我AddNewActor.html是
<div id="login">
<h2><span class="fontawesome"></span>Add New Actor</h2>
<form action="AddNewActor" method="post">
<fieldset>
<p><label for="firstName">Enter Actor First Name</label></p>
<p><input type="text" name="firstName" value="first name" onBlur="if(this.value=='')this.value='first name'" onFocus="if(this.value=='first name')this.value=''"></p> <!-- JS because of IE support; better: placeholder="[email protected]" -->
<p><label for="secondName">Enter Actor last Name</label></p>
<p><input type="text" name="lastName" value="last name" onBlur="if(this.value=='')this.value='last name'" onFocus="if(this.value=='last name')this.value=''"></p> <!-- JS because of IE support; better: placeholder="password" -->
<p><input type="submit" value="Submit"></p>
</fieldset>
</form>
</div>
和我的web.xml是
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Film Management System</display-name>
<servlet>
<display-name>ViewAllActors</display-name>
<servlet-name>ViewAllActors</servlet-name>
<servlet-class>com.flp.fms.controller.ViewAllActors</servlet-class>
</servlet>
<servlet>
<description>
</description>
<display-name>ViewALLFilms</display-name>
<servlet-name>ViewALLFilms</servlet-name>
<servlet-class>com.flp.fms.controller.ViewALLFilms</servlet-class>
</servlet>
<servlet>
<description>
</description>
<display-name>AddNewActor</display-name>
<servlet-name>AddNewActor</servlet-name>
<servlet-class>com.flp.fms.controller.AddNewActor</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewAllActors</servlet-name>
<url-pattern>/ViewAllActors</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ViewALLFilms</servlet-name>
<url-pattern>/ViewALLFilms</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddNewActor</servlet-name>
<url-pattern>/AddNewActor</url-pattern>
</servlet-mapping>
</web-app>
我AddNewActor.java(servlet的)
package com.flp.fms.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AddNewActor extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("tdctdt");
}
}