• Post Reply Bookmark Topic Watch Topic
  • New Topic

Loops in Dropdowns issue

 
casey Gould
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on an old site that we have, I'm adding a couple dropdowns to our forms.

With a connection to our database I can pull in values for selBaseCurr, But it's not pulling any values into the second dropdown for selTargetCurr

Am I missing something in the while loop?


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65529
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Old site" explains the presence of Java code and result sets in a JSP, both of which are no longer acceptable in modern web apps. (But you knew that, right?)

In this case, the first loop executes until the result set is exhausted, so when it gets to the second loop, the result set is already dead.

There may be a way to reset the result set (been a while since I've used raw JDBC), but if the content of both dropdowns is identical, I'd advocate looping through the result set once copying the values to a List, and then to iterate through that list twice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!