strtus2搭建步骤:
    1.拷贝所需jar到WEB工程目录下的lib01 Struts2 入门实例_第1张图片

    2.配置WEB.xml文件,配置过滤器Filter

        
          struts2
          
             org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
         
        
        
          struts2
          /*
        

    3.编写login.jsp:        

        
        

用户登录

        账号:
        密码:
                 

     4.创建LoginAction类继承ActionSupport类,重写execute()

package com.liu.web.action;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 用户登录的action
 * @author Administrator
 *
 */
public class LoginAction extends ActionSupport{
    private String userName;
    
    private String passWord;
    
    @Override
    public String execute() throws Exception {
        
        System.out.println("账号:"+userName);
        System.out.println("密码:"+passWord);
        
        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;
    }
}

        5.拷贝struts.xml配置文件到src目录下:

   
        
        
        
            
                /success.jsp