How to iterate over a CachedRowSet using
<logic:iterate > tags? I have filled the CachedRowset
with a select
statement and am able to iterate using the
crs.getString(1) or the crs.getString(colname)
methods,
but no am ready to use Struts tags but dont know how.
Do I need to convert it a Collection type? but that
will eat up more memory as two copies CRS and the
Collection with same contents?
Is it necessary to use the Struts tags to work with
the rest of the Struts features?
<?xml version="1.0"?>
<%@ page language="java" %>
<%@ page contentType="text/html" %>
<%@ page
import="sun.jdbc.rowset.CachedRowSet,javax.naming.InitialContext"%>
<jsp:useBean id="Contacts"
class="sun.jdbc.rowset.CachedRowSet" scope="session">
<% InitialContext ctx = new InitialContext();
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("java:/DefaultDS");
java.sql.Connection con = ds.getConnection();
Contacts.setCommand("SELECT name,
owner,species,sex,birth,death from pet");
Contacts.execute(con);
Contacts.first(); %> </jsp:useBean>
<logic:present name="Contacts" property="name">
<logic:iterate id="subs" name="Contacts"
type="sun.jdbc.rowset.CachedRowSet">
<bean:write name="subs" property="name"/>
</logic:iterate>
</logic:present>
But nothing is ever printed. if i take out the
logic:present and logic:iterate and replaced with a
while (Contacts.next() Contacts.getString(1) at
least
i gets some output.
__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>