Skip to content

Commit

Permalink
att
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavopedro20 committed May 22, 2019
1 parent f8ed00a commit 20b500b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 44 deletions.
2 changes: 1 addition & 1 deletion ProjetoPI/WebContent/ListarGrupos.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<c:import url="common/menu.jsp" />
</header>

<div id="main" class="container" role="main">
<div id="main" class="container">
<form action="controller.do" method="post" autocomplete="off">

<div id="top" class="row">
Expand Down
4 changes: 2 additions & 2 deletions ProjetoPI/build/classes/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/dao/
/command/
/controller/
/dao/
/filter/
/model/
/service/
/filter/
Binary file modified ProjetoPI/build/classes/controller/ServletController.class
Binary file not shown.
27 changes: 5 additions & 22 deletions ProjetoPI/src/command/EditarGrupo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,15 @@ public void executar(HttpServletRequest request,
gs.atualizar(grupo);

RequestDispatcher view = null;
HttpSession session = request.getSession();

@SuppressWarnings("unchecked")
ArrayList<Aluno> listaAluno = (ArrayList<Aluno>) session.getAttribute("lista_alunos");
//int pos = busca(grupo, listaGrupo);

// listaAluno.remove(pos);
// listaAluno.add(pos, grupo);

session.setAttribute("lista_alunos", listaAluno);
request.setAttribute("grupo", grupo);
HttpSession sessao = request.getSession();

// @SuppressWarnings("unchecked")
// ArrayList<Aluno> listaAluno = (ArrayList<Aluno>) sessao.getAttribute("lista_alunos");
// sessao.setAttribute("lista_alunos", listaAluno);
sessao.setAttribute("grupo", grupo);
view = request.getRequestDispatcher("VisualizarGrupo.jsp");
view.forward(request, response);

}

// public int busca(Grupo grupo, ArrayList<Grupo> lista) {
// Grupo to;
// for(int i = 0; i < lista.size(); i++){
// to = lista.get(i);
// if(to.getId() == grupo.getId()){
// return i;
// }
// }
// return -1;
// }

}
2 changes: 0 additions & 2 deletions ProjetoPI/src/command/EnviarAtividade.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public void executar(HttpServletRequest request, HttpServletResponse response)

String idAtividade = request.getParameter("id");
String linkEntrega = request.getParameter("entrega");

System.out.println("idAtividade: "+idAtividade+" *********** linkEntrega: "+linkEntrega);

TurmaAluno turmaAluno = new TurmaAluno();
turmaAluno = (TurmaAluno) sessao.getAttribute("turmaAluno");
Expand Down
5 changes: 3 additions & 2 deletions ProjetoPI/src/command/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void executar(HttpServletRequest request, HttpServletResponse response)
login = request.getParameter("email");
senha = request.getParameter("senha");
acesso = request.getParameter("acesso");


if (acesso.equals("Aluno")) {
loginAluno(request, response, login, senha);
Expand All @@ -38,7 +39,7 @@ public void executar(HttpServletRequest request, HttpServletResponse response)

} else {
RequestDispatcher disp = request.getRequestDispatcher("index.jsp");
disp.forward(request, response);
disp.include(request, response);
}

}
Expand All @@ -58,7 +59,7 @@ public static void loginAluno(HttpServletRequest request, HttpServletResponse re
TurmaAluno turmaAluno = new TurmaAluno();
turmaAluno = tas.carregarAlunoTurmaGrupo(alunoSession.getId());

if (alunoSession.getEmail() != null) {
if (alunoSession.getEmail() != null && turmaAluno.getId() != -1) {

HttpSession sessao = request.getSession();
sessao.setAttribute("alunoLogado", true);
Expand Down
25 changes: 13 additions & 12 deletions ProjetoPI/src/controller/ServletController.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@
public class ServletController extends HttpServlet {
private static final long serialVersionUID = 1L;

protected void doExecute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doExecute(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
request.setCharacterEncoding("UTF-8");
Command comando = (Command)Class.forName("command."+request.getParameter("command")).newInstance();
Command comando = (Command) Class.forName("command." + request.getParameter("command")).newInstance();
comando.executar(request, response);
} catch (InstantiationException | IllegalAccessException
| ClassNotFoundException e) {
e.printStackTrace();
throw new ServletException(e);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.getMessage();
}
}

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

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doExecute(request,response);
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doExecute(request, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doExecute(request, response);
}

}
6 changes: 3 additions & 3 deletions ProjetoPI/src/dao/TurmaAlunoDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public TurmaAluno carregarAlunoTurmaGrupo(int id) {
// turmaAluno.getTurma().setId(rs.getInt("turma_id"));
} else {
turmaAluno.setId(-1);
turmaAluno.getAluno().setId(-1);
turmaAluno.getGrupo().setId(-1);
turmaAluno.getTurma().setId(-1);
turmaAluno.setAluno(null);
turmaAluno.setGrupo(null);
turmaAluno.setGrupo(null);
}
} catch (SQLException e) {
e.printStackTrace();
Expand Down

0 comments on commit 20b500b

Please sign in to comment.