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 "Carole E. Mah" <ca...@mama.stg.brown.edu> on 2002/04/23 20:35:01 UTC

getColumn

I don't understand how to use the "to" attribute.

<%
     String myValue = request.getParameter("bar");
%>

<sql:getColumn colName="blort" to="myValue">

This is the sort of thing I want to do, I think. But it does not work,
i.e. the string "foo" has a value "bar" and that ought to get written over
by the value of colName "blort" but it does not.

Basically what I want is to get each row value of the 'blort' column from 
my "blah" DBtable, and write that to an <option> value.

In PHP, this would be:
        $query = "SELECT farble, blort FROM blah";
        $my_result = mysql_db_query ($dbname, $query, $linkid);
        echo "<select name=\"whatever\">";
        while ($my_row =mysql_fetch_object($my_result)) {
            $myValue = $my_row->blort;
            echo "<option value=\"$myValue\">$myValue</option>
        }
        echo "</select>";

Clearly "to" writes somewhere other than a scriplet variable.

?? I am not very smart today.

Thanks for any advice,
-Carole

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Carole E. Mah                     carolem@stg.brown.edu
           Senior Programmer/Analyst
   Brown University Scholarly Technology Group
               phn 401-863-2669
               fax 401-863-9313
            http://www.stg.brown.edu/
  personal: http://www.stg.brown.edu/~carolem/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: getColumn

Posted by Morgan Delagrange <md...@yahoo.com>.
Yes, the "to" attribute of the getColumn tag writes to a Servlet attribute,
not a scripting variable.  A scripting variable would have been awkward
because the "to" attribute is optional; by default the tag will simply write
to the current writer.

----- Original Message -----
From: "Carole E. Mah" <ca...@mama.stg.brown.edu>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Tuesday, April 23, 2002 1:35 PM
Subject: getColumn


>
> I don't understand how to use the "to" attribute.
>
> <%
>      String myValue = request.getParameter("bar");
> %>
>
> <sql:getColumn colName="blort" to="myValue">
>
> This is the sort of thing I want to do, I think. But it does not work,
> i.e. the string "foo" has a value "bar" and that ought to get written over
> by the value of colName "blort" but it does not.
>
> Basically what I want is to get each row value of the 'blort' column from
> my "blah" DBtable, and write that to an <option> value.
>
> In PHP, this would be:
>         $query = "SELECT farble, blort FROM blah";
>         $my_result = mysql_db_query ($dbname, $query, $linkid);
>         echo "<select name=\"whatever\">";
>         while ($my_row =mysql_fetch_object($my_result)) {
>             $myValue = $my_row->blort;
>             echo "<option value=\"$myValue\">$myValue</option>
>         }
>         echo "</select>";
>
> Clearly "to" writes somewhere other than a scriplet variable.
>
> ?? I am not very smart today.
>
> Thanks for any advice,
> -Carole
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Carole E. Mah                     carolem@stg.brown.edu
>            Senior Programmer/Analyst
>    Brown University Scholarly Technology Group
>                phn 401-863-2669
>                fax 401-863-9313
>             http://www.stg.brown.edu/
>   personal: http://www.stg.brown.edu/~carolem/
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>