Java 没有为命名空间[/]和操作名称映射的操作

Java 没有为命名空间[/]和操作名称映射的操作,java,eclipse,jsp,configuration,struts2,Java,Eclipse,Jsp,Configuration,Struts2,我正在学习Struts2。我有struts.xml文件: /login.jsp /index.jsp /login.jsp 我有我的登录选项。类: package org.dream.action; 导入org.apache.commons.lang3.StringUtils; 导入com.opensymphony.xwork2.Action; 导入com.opensymphony.xwork2.ActionSupport; 公共类LoginAction实现操作{ 私人字符串学生ID; 私有

我正在学习Struts2。我有
struts.xml
文件:


/login.jsp
/index.jsp
/login.jsp
我有我的
登录选项。类

package org.dream.action;
导入org.apache.commons.lang3.StringUtils;
导入com.opensymphony.xwork2.Action;
导入com.opensymphony.xwork2.ActionSupport;
公共类LoginAction实现操作{
私人字符串学生ID;
私有字符串密码;
公共字符串execute(){
如果(getStudentId().equals(“测试”)| | getPassword().equals(“测试”)){
回归成功;
}否则返回登录;
}
公共字符串getStudentId(){
返回学生ID;
}
public void setStudentId(字符串studentId){
this.studentId=studentId;
}
公共字符串getPassword(){
返回密码;
}
public void setPassword(字符串密码){
this.password=密码;
}
}
我有jsp文件

Login.jsp:


登录页面
当我按下sumbit按钮时,我得到一个错误:

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [loginStudent] associated with context path [/Struts2Demo]

我找不到这个错误的原因,请帮助我

指定
标记的名称空间属性,该属性应与struts.xml配置文件中的名称空间属性相匹配

<body>
    <s:form action="loginStudent" namespace="/">
        <s:textfield key="studentId" label="Student Id"/>
        <s:textfield key="password" label="Password"/>
        <s:submit/>
    </s:form> 

</body>


检查更新的答案。别忘了重新启动容器/服务器。同样,没有任何更改我也不明白。我重新启动了eclipse,程序获得了无误。我启动了我的初始代码,没有任何更改。在更改配置后,您几乎总是需要重新启动tomcat/应用程序服务器。@Yuriy Eclipse可能有bug,但这并不重要,问题是当您运行应用程序时,它缺少
struts.xml
中可用的配置设置。如果您在本地部署了它,Eclipse会将文件存储在metadata文件夹中,您应该检查这个包含所有必需文件的文件夹。因为你是新来的,所以你应该阅读。