Package action

Source Code of action.LoginActionBean

package action;

import bo.Admin;
import bo.Geolog;
import dao.AdminDao;
import dao.GeologDao;
import daoI.IAdminDao;
import daoI.IGeologDao;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;

public class LoginActionBean extends BaseActionBean {

    private String utilizator;
    private String parola;
   

    public Resolution submit() {
        if (parola == null || utilizator == null) {
            getContext().getRequest().getSession(true).setAttribute("user", -3);
            return new ForwardResolution("/WEB-INF/jsp/home.jsp");
        }
        IAdminDao adminDao = new AdminDao();
        Admin admin = adminDao.adminExistent(utilizator, parola);
        if (admin != null) {
            getContext().getRequest().getSession(true).setAttribute("admin", admin.getIdAdmin());
            return new ForwardResolution(GeologiActionBean.class, "validareConturi");
        }
        IGeologDao geo = new GeologDao();
        Geolog geolog = geo.geologExistent(utilizator, parola);
        if (geolog != null) {
            if ((geolog.getConfirmare().equals("in asteptare"))||(geolog.getConfirmare().equals("refuzat"))) {
                getContext().getRequest().getSession(true).setAttribute("user", -2);
                return new ForwardResolution("/WEB-INF/jsp/home.jsp");
            } else {
                getContext().getRequest().getSession(true).setAttribute("user", geolog.getIdGeolog());
                return new ForwardResolution("/WEB-INF/jsp/geologLogat.jsp");
            }
        } else {
            getContext().getRequest().getSession(true).setAttribute("user", -1);
            return new ForwardResolution("/WEB-INF/jsp/home.jsp");
        }
    }

    public Resolution inregistrare() {
        getContext().getRequest().getSession(true).setAttribute("inreg", 1);
        return new ForwardResolution("/WEB-INF/jsp/inregistrare.jsp");
    }

    public String getUtilizator() {
        return utilizator;
    }

    public void setUtilizator(String utilizator) {
        this.utilizator = utilizator;
    }

    public String getParola() {
        return parola;
    }

    public void setParola(String parola) {
        this.parola = parola;
    }
}
TOP

Related Classes of action.LoginActionBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.