OK, now we're getting somewhere. "a" is a string, so I'll ignore what you said earlier about "a" being an array. The following piece of code runs the loop in a
JSP page, and then generates a JavaScript handler where the final value of a is hard-coded as a parameter to the function. If the value of a is "a", then the alert should show "ab".
Be advised that it is bad design to have DB code in a JSP - you're much better off doing that in a backing bean. It also seems strange to assign multiple values to "a" in the loop, when apparently all that matters is the last contained in the last record.
[ March 21, 2007: Message edited by: Ulf Dittmer ]