struts.xml如下:<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts><package name="strutsqs" namespace="/" extends="struts-default" >
<action name="login" class="lee.LoginAction" ><result name="sucess">/welcome.jsp</result><result name="error">/error.jsp</result></action>
</package></struts>LoginAction.java 如下:
package lee;import com.opensymphony.xwork2.Action;
public class LoginAction implements Action{
private String username;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String execute() throws Exception
{

if(getUsername().equals("crazyit")&& getPassword().equals("leegang"))
{
return "SUCCESS" ;


}
else

{
return "ERROR";
}

}
}

解决方案 »

  1.   

    package lee;
    确定你导入的包没错??
      

  2.   

    D:\apache-tomcat-6.0.20\webapps\Struts2qs\WEB-INF\classes\lee\LoginAction.class
      

  3.   

    哈哈,一看就知道李刚书的例子。
    No result defined for action lee.LoginAction
    意思是找不到action的结果
    在struts.xml配置下的
    <result name="sucess">/welcome.jsp</result>的sucess应该改为success
    没修改的话,登录失败的页面应该可以实现,只是登录成功的实现不了。
      

  4.   

    那个success 写错了是一个问题,不是主要问题,主要问题是 return "SUCCESS" ;  改成 return SUCESS.
    不过谢谢各位热心的大侠,我还是要结分给你。呵呵
      

  5.   

    public interface Action extends Serializable {
    public static final String SUCCESS = "success";
    public static final String NONE = "none";
    public static final String ERROR = "error";
    public static final String INPUT = "input";
    public static final String LOGIN = "login";public String execute() throws Exception;
    }
    这是接口Action的声明,里面根本就没有定义SUCESS,你理解错了!