• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help returning array bean object

 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this is probably just a problem with the way my while loop is structured, but this is giving me a headache!!!



There are about 10 rows of info, with different names and location etc, but
when i run the code, the JSP displays the same info for all the bean objects- and it happens to be the info from the last row in the join table.

is it the while loop, or something with ResultSet? is there a different way to do this?
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only have one bean, and all 10 elements in the array refer to that same bean. And because you keep changing its data, when the code is all done, it contains the last row from the table.

I don't know why your method is designed to have a PatientBean as a parameter, but that bean is of no use to you. You need to create 10 beans, one for each row. Like this:
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul...you rock!
It works!
Thanks for the quick and helpful reply!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic