Re: CachedRowset with logic:iterate tag

2002-07-18 Thread @Basebeans.com

Subject: Re: CachedRowset with logic:iterate tag
From: David Chu [EMAIL PROTECTED]
 ===
Hi,
When first using struts, I first tried to use a CachedRowSet object as well.
However, based on other people's recommendations, I just went with a simple
Vector of Beans, one representing each row in the ResultSet.  It is true
this is more overhead, but no one has extended the CachedRowSet to have an
iterator which is what is necessary.

It is not necessary to use struts tags; you can use scriplets.  But it is so
nice to just use the struts tags.  You can achieve almost all of the same
functionality and it looks more like an html page.


-david

--
David C. Chu
America Online
Network Tools Intern
--

aps olute [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 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]




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: CachedRowset with logic:iterate tag

2002-07-18 Thread @Basebeans.com

Subject: Re: CachedRowset with logic:iterate tag
From: Vic C. [EMAIL PROTECTED]
 ===
I have extendend and made cached row set work with the iterator. See 
webPIM on sourceforge, basebeans.com or downloads.com

David Chu wrote:
 Hi,
 When first using struts, I first tried to use a CachedRowSet object as well.
 However, based on other people's recommendations, I just went with a simple
 Vector of Beans, one representing each row in the ResultSet.  It is true
 this is more overhead, but no one has extended the CachedRowSet to have an
 iterator which is what is necessary.
 
 It is not necessary to use struts tags; you can use scriplets.  But it is so
 nice to just use the struts tags.  You can achieve almost all of the same
 functionality and it looks more like an html page.
 
 
 -david
 
 --
 David C. Chu
 America Online
 Network Tools Intern
 --
 
 aps olute [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
 
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]
 
 
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: CachedRowset with logic:iterate tag

2002-07-18 Thread Chad Johnson

You could use the forEach tag from JSTL
(http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html).  forEach
can iterate over ResultSet's (and RowSet's via inheritance) with the
assistance from the helper class: javax.servlet.jsp.jstl.sql.ResultSupport .
ResultSupport can convert ResultSet's to the JSTL friendly Result class.

-Chad Johnson

- Original Message -
From: aps olute [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 17, 2002 6:19 PM
Subject: CachedRowset with logic:iterate tag


 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]





--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: CachedRowset with logic:iterate tag

2002-07-18 Thread aps olute

Ok from what I gather from the responses, it is not
necessary to use Struts Tags to iterate the contents
of the CachedRowSet.  However I would still like how
to do this. I've looked at webPIM, and were not able
to download as there are no jar files or zip files
package I saw at sourceforge.net, am not about to
pick bits and pieces and spend so much time putting it
together, if a better download site is provided i'd
apprecite it.
Am still not clear if it requires a Collection type
to do any of these iterations, not just logic, but in
html: tags too and what have you.

aps

__
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]