1 import org.lxh.mvcdemo.factory.DAOFactory; 2 import org.lxh.mvcdemo.vo.User; 3 4 import com.opensymphony.xwork2.ActionContext; 5 import com.opensymphony.xwork2.ActionSupport; 6 7 public class MVCAction extends ActionSupport{ 8 private String user_id; 9 private String user_pass;10 11 public String getUser_id() {12 return user_id;13 }14 15 public void setUser_id(String userId) {16 user_id = userId;17 }18 19 public String getUser_pass() {20 return user_pass;21 }22 23 public void setUser_pass(String userPass) {24 user_pass = userPass;25 }26 27 public String execute()throws Exception{28 User user = new User();29 //ActionContext.getContext().getSession().put("user_id", user_id);30 //ActionContext.getContext().getSession().put("user_pass", user_pass);31 32 user.setUserid(getUser_id());33 user.setPassword(getUser_pass());34 35 if(DAOFactory.getIUserDAOInstance().findLogin(user)){36 return "success";37 }else{38 return "error";39 }40 }41 }