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/03/11 14:51:07 UTC
why is there no dbtags getField tag ?
Instead of writing getColumn, is there a more intuitive method that uses the
field name instead getColumn ? For example the current method is this
<sql:statement id="stmt1" conn="conn1">
<sql:query> select * from members </sql:query>
<sql:resultSet id="rset2">
<sql:getColumn position="1"/>
<sql:getColumn position="2"/>
</sql:resultSet>
</sql:statement>
Why is there not something like this instead
<sql:statement id="stmt1" conn="conn1">
<sql:query> select * from members </sql:query>
<sql:resultSet id="rset2">
<sql:getField name="firstname" />
<sql:getField name="lastname" />
</sql:resultSet>
</sql:statement>
Or does something like this exist ?
Thank you, Soefara.
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: why is there no dbtags getField tag ?
Posted by horwat <Ju...@Sun.com>.
Check out the sql tags that are a part of the Standard tag library
implementation available in the jakarta taglibs project. You can use the
column name to get the column value when iterating over the rows:
<sql:update var="newTable">
create table mytable (
nameid int primary key,
name varchar(80)
)
</sql:update>
<sql:query var="resultSet">
SELECT * FROM mytable
</sql:query>
<%-- using the column name to access the value --%>
<c:forEach var="row" items="${resultSet.rows}">
Name: <c:out value="${row.NAMEID}"/>
Value: <c:out value="${row.NAME}"/>
</c:forEach>
Justy
----- Original Message -----
From: "Soefara Redzuan" <so...@hotmail.com>
To: <ta...@jakarta.apache.org>
Sent: Monday, March 11, 2002 5:51 AM
Subject: why is there no dbtags getField tag ?
> Instead of writing getColumn, is there a more intuitive method that uses
the
> field name instead getColumn ? For example the current method is this
>
> <sql:statement id="stmt1" conn="conn1">
> <sql:query> select * from members </sql:query>
> <sql:resultSet id="rset2">
> <sql:getColumn position="1"/>
> <sql:getColumn position="2"/>
> </sql:resultSet>
> </sql:statement>
>
> Why is there not something like this instead
>
> <sql:statement id="stmt1" conn="conn1">
> <sql:query> select * from members </sql:query>
> <sql:resultSet id="rset2">
> <sql:getField name="firstname" />
> <sql:getField name="lastname" />
> </sql:resultSet>
> </sql:statement>
>
> Or does something like this exist ?
>
> Thank you, Soefara.
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> 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>