As somebody kindly pointed out off list, it should be "if you are comparing
strings, you need to use .equals not ==". He is correct, and this made me
realize that I didn't express the question clearly. I was actually trying to
confirm whether the output from taglibs can be used within scriptlet
expressions.
<% if (x == %><sql:getColumn colName="X"/><% ) { %>selected<% } %>
Because I keep getting JSP compiler errors. If <sql:getColumn colName="X">
returns the value Xval, is this in actual fact converted to the Java code
out.write(Xval) ? If so, that will break the scriptlet.
How does one do such comparisons ?
Soefara Redzuan.
>From: "Soefara Redzuan" <[EMAIL PROTECTED]>
>Reply-To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: How to pre-select an option in a pull-down Date: Thu, 09 May 2002
>19:50:02 +0800
>
>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:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>