初学Struts2,总是出现404问题,不知道是哪里写错了,实在是找不到,求大神们帮忙。。

jsp页:

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">


<!-- Struts2的所有Action都需位于package下 -->

<!-- 定义名为login的Action,其实现类为LoginAction类 -->

<!-- 如果处理结果返回error,对应/error.jsp视图资源 -->
/error.jsp
<!-- 如果处理结果返回success,对应/welcome.jsp视图资源 -->
/welcome.jsp


 action 类:
 package com.struts.logindemo;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;


public class loginDemoAction extends ActionSupport{

    String username ;
    String userpassword ;
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getUserpassword() {
        return userpassword;
    }
    public void setUserpassword(String userpassword) {
        this.userpassword = userpassword;
    }
    public String execute()
    {
        System.out.println("================================");
        System.out.println("用户名是:"+username);
        if(username.equals("lee"))
            {
                System.out.println("+++++++++++++++++++++++");
                return SUCCESS;
            }
        else
            return ERROR;
    }
}




jsp页:

struts.xml中有问题吗?代码贴出来看看,还有你的jsp页面是否存在

只有这个页面看不出哪里有问题,你把jsp代码和xml代码贴出来看看!

很可能是你的配置文件没有配置对,找不到action

这种情况一般是struts.xml的配置问题