I'm messing with jsp. In my servlet
I have if
and else if
and both send to the same page, only with different values. However, when you enter the if
option (it shows the result) and then when you return the page and try the else if
option, it does not work. How can I solve this?
As an example:
RequestDispatcher rd;
if (/*condicao*/) {
arquivo.tarefa1 = 0;
request.getSession().setAttribute("arquivo", arquivo);
rd = request.getRequestDispatcher("resposta1.jsp");
}
else {
arquivo.tarefa2 = 1;
request.getSession().setAttribute("arquivo", arquivo);
rd = request.getRequestDispatcher("resposta1.jsp");
}
rd.forward(request, response);
In case, I did not put the different values that I step to the page .. but the necessary I believe it to be that.
When run and enter the if
option and then return the page and enter the else
option it does not work.
The request passes file, an object I created.