1
I’m messing with jsp. In mine servlet
have if
and else if
and they both send to the same page, only with different values. However, when you enter the if
(shows the result) and then when it returns the page and tries the option of else if
, doesn’t work. How do I fix 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 this case, I did not put the different values that I pass to the page. but the necessary I believe is this.
When executed and enters the if
and then go back to the page and enter the else
it doesn’t work.
request passes file, an object I created.
Friend, read your question carefully and think carefully about the amount of code you have given us so we can know what you are trying to do.
– Victor Stafusa
Your question is confused.
– Marconi