package chat2;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;

public class LoginAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) {
        LoginActionForm loginActionForm = (LoginActionForm) form;
       String userName=loginActionForm.getUserName();
       String password=loginActionForm.getPassword();
       UserBean user=new UserBean();
       boolean flag=user.verifyUser(userName,password);
       if(flag){
           return mapping.findForward("success");
       }
       else
       {
           return mapping.findForward("error");
       }
    }
}
