As a novice to JSP it's important that you learn JSP correctly and you're on a very bad track.
After the introduction of JSP2 in 2002 -- yes, 10 years ago - putting
Java code, and especially database code, into a JSP is considered an unacceptable practice. It still exists for compatibility with legacy applications, but any JSP written after 2002 should be using the JSTL (JSP Standard Tag Library) and EL (Expression Language) in place of Java scriptlets.
I'd also recommend reading the following articles:
The Secret Life of JSPsThe Front Man
But what it comes down to is as easy as this: if you want a particular option in the drop down to be selected, you put the
selected attribute on the option. For example:
<option value="whatever" selected>Whatever!</option>
Frequently the EL's ternary operator is useful for this. For example: