Eclipse部署HTTP状态404-找不到

时间:2019-03-02 16:33:58

标签: javascript eclipse spring-mvc struts2 glassfish

我正在启动一个网站项目,该项目具有管理员登录名,但是每次我点击“提交”时,都会不断出现此错误

screenshot

HTTP Status 404 - Not Found
type Status report

message Not Found

description The requested resource is not available.

我正在使用eclipse IDE和glassfish作为部署服务器。第一页有一个登录表单

<form action="AdminAction">      
      <label for="name">Please enter your login and password:</label><br/><br/>
      Login:  <input type="text" name="login"/><br/></br>
      Password:  <input type="password" name="pw"/><br/></br>
      <input type="submit" value="Submit"/>
</form>

它应该导致我在strut文件中配置的action="AdminAction"

<struts>
<constant name="struts.devMode" value="true" />
   <package name="Users" extends="struts-default">

        <action name="AdminAction" class="staff.mvc.AdminAction"
            method="post">
            <result name="success">/WEB-INF/jsp/admin_index.jsp</result>
            <result name="error">/WEB-INF/jsp/admin_error.jsp</result>
        </action>

    </package>
    </struts>

如果管理员ID和密码正确,则显示此页面

<html>
<head>
<title>Welcome Administrator</title>
</head>
<body>
<h2>Welcome,Admin</h2>
  <a href="allUsersAction"> List of All Users </a> &nbsp;&nbsp;&nbsp; <a href="insertUsersAction"> Add new user </a>  
</body>
</html>     

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/j2ee" 
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" 
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_9" version="2.4">
  <display-name>Struts Example</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
</web-app>

知道为什么我会不断收到404错误吗?

0 个答案:

没有答案