问答详情
源自:4-8 接收参数-深入Struts2

请问,这错误找不到了

出现这样错误

HTTP Status 404 - There is no Action mapped for namespace / and action name LoginAction.

type Status report

message There is no Action mapped for namespace / and action name LoginAction.

description The requested resource (There is no Action mapped for namespace / and action name LoginAction.) is not available.


代码:

<form action="LoginAction.action" method="post">

  用户名:<input type="text" name="username">

  密码:<input type="password" name="password"> 

  <input type="submit" value="提交"/>

  </form>



<package name="default" extends="struts-default">

<action name="LoginAction" method="login"  class="com.xaccp.Action.LoginAction">

<result>/success.jsp</result>

</action>

</package>



public class LoginAction extends ActionSupport {

private String username;

private String password;

public String login(){

System.out.println(username);

return SUCCESS;

}

public String getUsername() {

return username;

}

public void setUsername(String username) {

this.username = username;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

this.password = password;

}

}



求解

提问者:努力GOGO 2016-01-02 17:20

个回答

  • 产品经理不是经理
    2016-01-02 17:28:13
    已采纳

    <form action="LoginAction.action" method="post">是这里action后的路径写错了吧

  • 努力GOGO
    2016-01-02 20:30:56

    谢谢大家,我找出来了 没写<include file="helloworld.xml"></include>这句话

  • 努力GOGO
    2016-01-02 17:37:57

    警告: Could not find action or result

    There is no Action mapped for namespace / and action name LoginAction. - [unknown location]