You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Soefara Redzuan <so...@hotmail.com> on 2002/05/09 13:50:02 UTC
How to pre-select an option in a pull-down
I wish to create a pull-down where the options are pulled from a database,
but pre-select one of the options depending on a scriptlet value. Here is an
easier example.
<%
String chosencolor="red";
%>
<select name="color">
<sql:preparedStatement id="stmt" conn="conn">
<sql:query>
select color from allcolors
</sql:query>
<sql:resultSet id="rset">
<option <% if (chosencolor == %><sql:getColumn colName="color"/><% ) {
%>selected<% } %>/>"><sql:getColumn colName="color"/>
</sql:resultSet>
</sql:preparedStatement>
</select>
As you can see it's a mess on the option line and it doesn't work. :(
How can I use the <sql: geColumn> output inside a scriptlet ?
Again I must be overlooking something.
Soefara Redzuan.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>