This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic iterate doesnt show me correct data

 
JoseDeJesus Arena
Greenhorn
Posts: 4
Android Eclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everybody, I need your help, because I need to Iterate a List with strut´s logic:iterate tag, but I only getting the information of the last record of the query that I excecute before, for example the result of my sql query it´s something like this

1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5

When I excecute my code, the JSP only repetme five times the last record

5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5


here is a snippet of my code from my action class

Here I call a method named generarReportes, an here a snippet form my implementation

And finally in my JSP

So could you please help me to figured out whats wrong with my code??
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
Please UseCodeTags when you post code. It preserves the formatting and makes it easier to read.
As for your problem, you should ask yourself how many instances of serviciosVO should be in listaAgendados.
 
JoseDeJesus Arena
Greenhorn
Posts: 4
Android Eclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice Joe, and yes you are complete right because inside the while I just had a instance of my object, so every time execute that line just overwrite my instance, so what I did it was inside the while create a new instance of my object and it works fine

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic