You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2001/07/08 11:41:06 UTC
Re[2]: Struts 1.1 To-Do - RowSets
Hello Ted,
I try to use your RowSet wrapper as iterator for logic:iterate and
all is ok (I use CachedRowSet though for disconnected RowSet
implementation). To show values from RowSet I use bean:write tags -
<bean:write name="rows" property="object[2]"/>
Of course it is not so usable to place column indexes to the
attribute value, but 'named' property support can be great
enhancement to PropertyUtils and so -
<bean:write name="rows" property="object[category]"/>
I think its enough to give page developer ability to read values from
rowset. And more - 'named' properties support is really forthcoming
feature in struts.
--
Best regards,
Oleg mailto:gonza@penza.net
Re: Struts 1.1 To-Do - RowSets
Posted by Ted Husted <hu...@apache.org>.
Now that I've started to use the RowSet version of the dbTag ResultSet
tags, I'm finding them very useful. It starts out like the
logic:iterator/bean:write duo, but offers several other useful options:
* A loop property, to display one column and stop.
* A colName property to retrieve the value by column name.
* Speciality accessors for numeric and date columns, with useful
transformation switches.
I've updated the taglib Bill Pfeiffer started so that it can take the
name and property parameters like the Struts tags. The JAR, with source,
is up on More About Struts now.
< http://husted.com/about/struts/rowsettags.htm >
The usage is quite simple.
* From your action, insert the RowSet into the request context, either
on its own or as a property of another object.
* In your JSP, start out with something like
<db:rowSet id="row" name="result" property="rows.values">
where you would use the Struts iterator.
* To expose column values, use
<db:getColumn colName="contact"/>
* To transfer a column to a scripting value, to use with bean or logic
tags, use
<db:getColumn colName="contact" to="CONTACT"/>
See the Jakarta Tablibs dbTag documentation for more. It works the same
as the ResultSet tag, but with a given RowSet.
I also have an update to the RowSet iterator class (ValueIterator) up
too. This one includes generic toMap() and Set(map) methods for
transfering data to and from the RowSet. It uses MetaData and so can be
used with any RowSet without subclassing.
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/