You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Upayavira <uv...@upaya.co.uk> on 2004/07/23 17:27:21 UTC
Re: RresultSet within JXTemplate?
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
Re: RresultSet within JXTemplate?
Posted by Leszek Gawron <lg...@mobilebox.pl>.
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