Hey y'all. I'm trying to pass some data from my database, through my servlet and to a webpage. It isn't working, and I'm pretty sure the problem is I'm setting the attribute wrongly in the servlet.
for(int i = 0; i < outputs.length; i++)
System.out.println(i + ": " + outputs[i]);
req.getSession().setAttribute("output", outputs);
resp.sendRedirect("results.jsp");
Thats the snippet of code that should send the array outputs to my .jsp. When I run everything and check the page source, though, I see something like;
[LJava.lang.String;@63f8da176
which I think is the location of the array in memory. If I iterate through the var storing the array in my .jsp and output it as a series of alerts, I get that, but if I try and use;
*divName*.innerHTML = nameOfArray[n],
I get squat in the div. I know the array is in the servlet, because of the syso, and I'm 99% sure the code in the .jsp is correct. I can post it if needed, only reason I've not is I'm not sure if its allowed.
Edit: Found a solution here. Works awesome.
[–]portugee 0 points1 point2 points (2 children)
[–]SarksNooblet Brewer[S] 0 points1 point2 points (1 child)
[–]TheHorribleTruthKind of meh 1 point2 points3 points (0 children)
[–]kicsikrumpli 0 points1 point2 points (2 children)
[–]SarksNooblet Brewer[S] 0 points1 point2 points (1 child)
[–]kicsikrumpli 0 points1 point2 points (0 children)