package commands;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import business.Sala;
import dao.FacadeDAO;

public class SalaListar extends AbstractCommand {

	public void processarComando(HttpServletRequest request,
			HttpServletResponse response, HttpServlet servlet) {

		List<Sala> salas = FacadeDAO.getInstance(servlet).getSalaDAO()
				.listarSalas();

		request.setAttribute("lista_salas", salas);

		RequestDispatcher rd = request.getRequestDispatcher("salaListar.jsp");
		try {
			rd.forward(request, response);
		} catch (ServletException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
