cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: RresultSet within JXTemplate?
Date Fri, 23 Jul 2004 18:07:55 GMT
Upayavira wrote:
> Stephan Coboos wrote:
> 
>> Hello,
>>
>> is it possible to set a java.sql.ResultSet witin a JXTemplate and then 
>> iterate over the contents?
>>
>> I need this way to print out > 600000 Elements from a database into an 
>> xml. So it is not possible to create beans before.
>>
> First answer: dunno.
> Second answer: does ResultSet implement java.util.Collection? If so, I 
> suspect you could do it.
> Third answer: if ResultSet doesn't implement Collection, then you could 
> write a simple wrapper class that does, along with a simple 
> implementation of Iterator, that can iterate over the rows of a ResultSet.
> 
> Hope that helps.
> 
> Upayavira
it does not implement collection but I think you could implement 
iterator wrapper anyway (almost same semantics in ResultSet and 
Iterator). You could do it like this then:

var wrapper = new Packages.sumthin.sumthin.MyRSWrapper( resultSet );
cocoon.sendPage( "view", { results: wrapper } );
in template:

<jx:forEach var="row" items="${results}">
	<dosomestuff/>
<jx:forEach>

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65


Mime
View raw message