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

package commands;

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

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

import spring.Context;

import business.Curso;
import dao.CursoDAO;

/**
 * 
 * @author Carine
 */
public class CursoListarAlteracao extends AbstractCommand {
	CursoDAO cursodao = new CursoDAO();

	/** Método que processa o comando de listar o curso alterado */
	public void processarComando(HttpServletRequest request,
			HttpServletResponse response, Context context) {

		List<Curso> cursos = cursodao.listarCursos();

		request.setAttribute("lista_cursos", cursos);

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