/** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // TODO Auto-generated method stub

    if (request.getSession(false) != null) {
      request.getRequestDispatcher("/acesso.do").forward(request, response);
    }
    Professor professor = (Professor) Fachada.getInstance().criarProfessor();
    professor.setLogin(request.getParameter("login"));
    professor.setNome(request.getParameter("nome"));
    professor.setSobrenome(request.getParameter("sobrenome"));
    professor.setEmail(request.getParameter("email"));
    professor.setSenha(request.getParameter("senha"));
    professor = Fachada.getInstance().cadastrarProfessor(professor);
    String[] materias = request.getParameterValues("disciplinas");
    if (materias != null) {
      for (int x = 0; x < materias.length; x++) {
        Disciplina disciplina = (Disciplina) Fachada.getInstance().criarDisciplina();
        Disciplina disciplinaRetornada = null;
        disciplina.setDescricao(materias[x]);

        disciplinaRetornada = comparaDisciplinas(disciplina);
        disciplinaRetornada.setProfessor(professor);
        Fachada.getInstance().atualizarDisciplina(disciplinaRetornada);
      }
    }

    request.getRequestDispatcher("/acesso.do").forward(request, response);
  }
  protected Disciplina comparaDisciplinas(Disciplina disc) {

    Disciplina objDisciplina = null;

    for (int i = 0; i < listaDisciplinas.size(); i++) {
      if (listaDisciplinas.get(i).getDescricao().equals(disc.getDescricao())) {
        objDisciplina = listaDisciplinas.get(i);
      }
    }

    return objDisciplina;
  }