/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.ddns.grupotsergio;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.omg.PortableServer.POAPackage.ServantAlreadyActive;

/**
 *
 * @author Administrator
 */
public class ValidarSessao {

    public static void validarSessao(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
        Integer codUsu = (Integer) request.getSession().getAttribute("codUsu");
        String jsp = "";
        if(codUsu == null){
            jsp = "/acesso.jsp";
            //redirecionando a pagina
            RequestDispatcher rd = request.getRequestDispatcher(jsp);
            rd.forward(request, response);
        }
    }
}
