On Wednesday, July 2, 2003, at 07:23 PM, Christopher Oliver wrote:


Many thanks for your reply.

This seems to be a limitation of JXPath.

OK


I'll try to look into it.

That would be great.


As a workaround you can set your own loop index variable:

<t:set var="position" value="#{1}"/>
<t:forEach items="#{pageNames}">
<a href="#" onmousedown="doAction('#{$PAGEACTION}','#{$position}')">#{.}</a><br/>
<t:set var="position" value="#{$position + 1}"/>
</t:forEach>

I tried to do something similar to the above yesterday, could not get it to work (struggling with the syntax), so output {index,data} from my Bean instead, which is a bit of a hack ..... so I'll try your workaround.


regards Jeremy

Jeremy Quinn wrote:

(I think I sent this just as the mailing lists were being changed over, my apologies if two copies arrive)



Hi All,

Anyone got an idea what I am doing wrong here?

I have a java.util.ArrayList called "pageNames", populated with Strings, that I want to output (along with their index) using JX Template.

<t:forEach items="#{pageNames}">
<a href="#" onmousedown="doAction('#{$PAGEACTION}','#{position()}')">#{.}</a><br/>> >
</t:forEach>


The output I get looks like this:

<a href="#" onmousedown="doAction('PAGE_THUS','0')">Abdu'Allah</a><br/>
<a href="#" onmousedown="doAction('PAGE_THUS','0')">Budgett</a><br/>
<a href="#" onmousedown="doAction('PAGE_THUS','0')">Evans</a><br/>
...... ^


ie. 'position()' is not working as I would expect it to do, (from my experience with XSLT).

Should I expect it to work the same way?
Is there an alternative way of doing this?


Thanks for any help


regards Jeremy







Reply via email to