package commands;

import business.Disciplina;
import dao.DisciplinaDAO;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import spring.Context;

public class DisciplinaListaDados extends AbstractCommand {

	private DisciplinaDAO disciplinaDAO = new DisciplinaDAO();

	public DisciplinaListaDados() {
		super();
	}

	@Override
	// public void executarComando(HttpServletRequest request,
	// HttpServletResponse response) throws IOException, ServletException {
	public void processarComando(HttpServletRequest request,
			HttpServletResponse response, Context context) throws IOException,
			ServletException {
		ArrayList<Disciplina> disciplinas = (ArrayList<Disciplina>) disciplinaDAO
				.listaDados();
		request.setAttribute("disciplinas", disciplinas);
		RequestDispatcher rd = request
				.getRequestDispatcher("disciplinaListaDados.jsp");
		rd.forward(request, response);
	}

}
