this is the scenario:
On the one hand I have a .java where I want to put a variable in session doing this:
String [] matriz = new String[5];
matriz[0] = "Hola";
matriz[1] = "que";
matriz[2] = "tal";
matriz[3] = "estas";
request.getSession().setAttribute("Resultado", matriz);
On the other hand I have a .jsp where I want to pick it up and print it using this:
(The code is inserted correctly Code % >
String[] mensaje = (String[]) request.getSession().getAttribute("Resultado");
if(mensaje == null) out.println("No se ha podido recuperar el mensaje de la sesion.");
else{
for(int i = 0; i < mensaje.length; i++){
out.println(mensaje[i]);
}
}
However, when I execute it, it tells me that "message" the attribute where I try to recover the array of the session is "null".
Can you tell me where I'm wrong?
Thanks in advance to all who try.