请问,这错误找不到了

来源:4-8 接收参数-深入Struts2

努力GOGO

2016-01-02 17:20

出现这样错误

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;

}

}



求解

写回答 关注

3回答

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

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

    努力GOGO 回复产品经理不是...

    没报错 但是页面空白什么都没有

    2016-01-02 18:01:31

    共 4 条回复 >

  • 努力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]

Struts2入门

本教程带你踏上Struts2学习之旅,对Struts2进行更深入讲解

95062 学习 · 456 问题

查看课程

相似问题