protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    AlunoDAO dao = new AlunoDAO();
    Aluno aluno = new Aluno();

    String operacao = request.getParameter("operacao");

    switch (operacao) {
      case "incluir":
        aluno.setNome(request.getParameter("nome"));
        aluno.setAtivo(Boolean.parseBoolean(request.getParameter("ativo")));
        aluno.setEmail(request.getParameter("email"));
        aluno.setEndereco(request.getParameter("endereco"));
        aluno.setIdade(Integer.parseInt(request.getParameter("idade")));
        aluno.setMatricula(Long.parseLong(request.getParameter("matricula")));
        aluno.setTelefone(Long.parseLong(request.getParameter("telefone")));
        dao.save(aluno);

        response.sendRedirect("listar.jsp");
        break;

      case "deletar":
        aluno.setId(Integer.parseInt(request.getParameter("id")));
        dao.delete(aluno);
        response.sendRedirect("listar.jsp");

        break;

      case "atualizar":
        aluno.setId(Integer.parseInt(request.getParameter("id")));
        aluno.setNome(request.getParameter("nome"));
        aluno.setEmail(request.getParameter("email"));
        aluno.setEndereco(request.getParameter("endereco"));
        aluno.setIdade(Integer.parseInt(request.getParameter("idade")));
        aluno.setMatricula(Long.parseLong(request.getParameter("matricula")));
        aluno.setTelefone(Long.parseLong(request.getParameter("telefone")));
        aluno.setAtivo(Boolean.parseBoolean(request.getParameter("ativo")));

        dao.update(aluno);

        response.sendRedirect("listar.jsp");
        break;
    }
  }
  public static void atualizar() {
    aluno = daoAluno.getById(1);
    aluno.setNome("João");
    daoAluno.update(aluno);

    curso = daoCurso.getById(1);
    curso.setNome("Letras");
    daoCurso.update(curso);

    professor = daoProfessor.getById(1);
    professor.setNome("Maria");
    daoProfessor.update(professor);

    turma = daoTurma.getById(1);
    turma.setPeriodo("Matutino");
    daoTurma.update(turma);

    matricula = daoMatricula.getById(1);
    matricula.setCodigoMatricula(123);
    daoMatricula.update(matricula);
  }