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 "Bohlen, Matthias, fiscus GmbH, Bonn" <M....@fiscus.info> on 2002/04/23 12:41:05 UTC

dbtags: How do I use the results to create a link?

Hi,

I am using the dbtags library to query a database. I am getting a resultset
and I would like to create a link to another page that contains the value of
a database cell as a parameter.

The code looks like this:

    <sql:statement id="stmt1" conn="conn1">
      <sql:query>
        select id, description from COLORS order by id
      </sql:query>
      <%-- loop through the rows of your query --%>
      <sql:resultSet id="rset2">
        <tr>
          <td><sql:getColumn position="1"/></td>
          <td>
            <a href="details.jsp?colorId=*insert value of 1st getColumn
here*">
               Details about <sql:getColumn position="2"/>
            </a>
          </td>
        </tr>
      </sql:resultSet>
    </sql:statement>

The output should look like this:
1 Details about red
2 Details about green
3 Details about blue

where red, green and blue would be clickable links to details.jsp?colorId=1,
details.jsp?colorId=2, details.jsp?colorId=3 and so on.

How should I code this?

Tnx...
Matthias Bohlen

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