cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: JXTemplate: nested forEach problem
Date Tue, 10 Feb 2004 15:39:34 GMT
What does your flowscript look like? Just a guess, but is it possible 
you are catching the exception from 
sendPage*("pipeline-containing-your-template") in  your script? That 
could explain the "generator already set" error (which occurs when you 
incorrectly call sendPage*() more than once in the same flowscript 
invocation - i.e. after catching the exception your script "falls 
through" to the next sendPage*()).

HTH,

Chris

Jeremy Quinn wrote:

> I have a set of nested Beans, from with I am trying to extract values  
> using JXTemplate.
>
> album - an Album Bean
>     title - String
>     text - String
>     . . .
>     resources - ArrayList of Resource Beans
>         artefact - String
>         text - String
>         images - ArrayList of Image Beans
>             image - String
>         . . .
>
> Here is part of the Template :
>
> <t:forEach items="#{album/resources}">
>   <section>
>     <title>
>     <a href="../artefacts/work(#{artefact}).html" title="view the 
> full  artefact">
>          <!-- snip -->
>     </a>
>     </title>
>     <p>IMAGES: #{count(images)}</p>  <!-- this reports 2 images -->
>     <t:forEach items="#{images}">      <!-- this throws an exception -->
>       <a href="../artefacts/image(#{image}).html" title="view  
> information about this image">
>         <img alt="image: #{image}"  
> src="../images/thumbnail/artefacts/#{image}.jpg"/>
>       </a><xsl:text>&#160;</xsl:text>
>     </t:forEach>
>     <p title="albums.album.commentary" i18n:attr="title">#{text}</p>
>   </section>
> </t:forEach>
>
> This all works fine if I take out the inner 'forEach'.
> When I leave it in I get the far from helpful (currently in 
> 2.1.4-dev,  generic) Exception:
>
> org.apache.cocoon.ProcessingException: Generator already set. Cannot  
> set generator 'jx' at  
> file:/Users/jerm/Development/Checkouts/someproject/webapp/album.xmap: 
> 37:62
>         at  
> org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setGene 
> rator(AbstractProcessingPipeline.java:243)
>         at  
> org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe 
> line.setGenerator(AbstractCachingProcessingPipeline.java:158)
>
> etc.
>
> What I do not understand is that this works :
>     #{count(images)}
> But this throws exceptions :
>     <t:forEach items="#{images}">
>
> Any suggestions?
> I have tried all of the variations in the documentation and User's 
> List  that I could find.
>
> thanks
>
> regards Jeremy



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message