Pessoal, como faço para recuperar um valor do banco e selecioná-lo no combobox?
Estou fazendo desta maneira mas não está funcionando, alguma dica?
<option value=<%=rs_combo.getString("nome_usuario")%><%if(rs_combo.getString("nome_usuario").equals(rs.getString("emissor"))) out.print("selected");%>><%=rs_combo.getString("nome_usuario")%></option>
Aqui está o codigo completo:
<%
new Conexao();
ResultSet rs = Conexao.stm.executeQuery("SELECT * FROM tdp_ata where (id_tdp = '"+idAtaTdp+"')");
rs.next();
Date dataEdita = rs.getDate("data");
String gpaEdita = rs.getString("gpa");
String tpaEdita = rs.getString("tpa");
String posEdita = rs.getString("pos");
String assuntoEdita = rs.getString("assunto");
String emissorEdita = rs.getString("emissor");
%>
<TABLE class=tableposres cellSpacing=1 width="90%" align=center>
<TBODY>
<TR>
<TH colspan="3">Ata do TDP</TH>
</TR>
</TABLE>
<!-- FORM 1 -->
<form name="ARTIGO" method="post" action="../TdpAltera" onsubmit="return valida(this);">
<table class=tableposres align="center" style="width: 90%;" border="0" cellpadding="0" cellspacing="2">
<tr>
<td class=rowpos><label for="contact_subject" class=gensmall>*Data Cadastro:</label><br>
<input type="text" name="dataEdita" id="cal-field-1" class="post" size="10" value="<%=FormatadorDatas.formatoBrasil_sem_hora(dataEdita)%>" tabindex="1" maxlength="10"/>
<a href="#"><img src="../images/calendar.png" id="cal-button-1" border="0"></a>
<script type="text/javascript">
Calendar.setup({
inputField : "cal-field-1",
button : "cal-button-1",
align : "Br"
});
</script>
</td>
<td class=rowpos><label for="contact_subject" class=gensmall>GPA:</label><br>
<input type="text" name="gpaEdita" id="gpaEdita" class="post" size="10" value="<%=gpaEdita %>" tabindex="3" maxlength="6"/></td>
<td class=rowpos><label for="contact_subject" class=gensmall>TPA:</label><br>
<input type="text" name="tpaEdita" id="tpaEdita" class="post" size="10" value="<%=tpaEdita %>" tabindex="3" maxlength="6"/></td>
<td class=rowpos><label for="contact_subject" class=gensmall>POS:</label><br>
<input type="text" name="posEdita" id="posEdita" class="post" size="10" value="<%=posEdita %>" tabindex="3" maxlength="6"/></td>
<td class=rowpos><label for="contact_subject" class=gensmall>*EMISSOR:</label><br>
<select name="emissorEdita" size="1" class="select">";
<%
ResultSet rs_combo = rs_combo = Conexao.stm1.executeQuery("select * from usuarios order by nome_usuario");
while(rs_combo.next())
{
%>
<option value=<%=rs_combo.getString("nome_usuario")%><%if(rs_combo.getString("nome_usuario").equals(rs.getString("emissor"))) out.print("selected");%>><%=rs_combo.getString("nome_usuario")%></option>
<%
}
%>
</td>
</tr>
<tr>
<td class=rowpos colspan="5"><label for="contact_message" class=gensmall>*Assunto:</label><br>
<textarea name="assuntoEdita" id="assuntoEdita" cols="95" class=post rows="10" tabindex="6"><%=assuntoEdita %></textarea></td>
</tr>
</table>
<input type="hidden" name="acao" value="editarTdp">
</form>