This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why getProperty values a different data records  RSS feed

 
Maxi Wang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The purpose , in index.jsp call javabeans, my database has four reocords in all, but javabeans runs out of index.jsp to be only one record. and delete serial number address is 4 , it is wrong! Is it del.jsp?PersonID =1 is correct, because this is serial number is 1, who can tell me the fault that where my logic,and it is four records that right , but the page has one records , thanks.
Bean Code is:
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It seems from the method signature that you want to get the next record from the resultset - rs.

But in your while loop you iterate through all records and keep initialising the variable count, so in the end, the variable - count will have value of PersonID in the last record.

If you want the variable - count to return the value of PersonID in ech record then instead of while() loop just use if() to fetch just one record at each method call.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!