Sure, but I don't think it addresses my problem. My problem isn't creating a list, my problem is delimiting values on each iteration of Loop, without having a trailing or leading delimiter.

Sven Homburg wrote:
Hi Chris,

may i advise you the listbinding from t5components ?

<ul>
    <li t:type="Loop" source="list:\"value 1\", \"value 2\", \"value
3\"" value="element">
        ${element}
    </li>
</ul>



2008/1/13, Chris Lewis <[EMAIL PROTECTED]>:
That would work of course, but I'd like to do something like this:

<t:loop source="strings" value="var:string" index="prop:index"
delimit=", ">
  <a href="#" t:type="pagelink" page="nada"
context="var:string">${var:string}</a>
</t:loop>

And then each element would be separated by my delimiter without any
extra java code.

Robert Zeigler wrote:
How about testing the value of index?
Something like:

.java:

private int index;
public int getIndex() { return index; }
public void setIndex(int i) index = i; }
public boolean isFirst() { return index==0; }

.tml:

<t:loop source="strings" value="var:string" index="prop:index">
  <t:if test="prop:first" negate="true">
    ,
  </t:if>
  <a href="#" t:type="pagelink" page="nada"
context="var:string">${var:string}</a>
</t:loop>

Robert

On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:

Sorry, I missed the "check if first" part. How can you do such a
check in Loop? The "If" can test, but what can you test in a Loop?
nothing that I know of will tell you where in the iteration you are.

chris

Davor Hrg wrote:
just reverse where you write the ","
instead of checking if last and putting comma behind

check if first and put comma in front

Davor Hrg

On Jan 12, 2008 11:04 PM, Chris Lewis <[EMAIL PROTECTED]>
wrote:

So this ticket has been implemented in svn:
https://issues.apache.org/jira/browse/TAPESTRY-2028

And now I need whitespace... so how can I get it back? Is there or
isn't
there a way to disable this? Im using loop to output links
(pagelinks),
and i have whitespace behind in the body so there is separation.
Unfortunately, it's getting stripped. Is there a workaround?

On a related note, is there a way to know if im on the last
iteration of
the loop, so i could for example, follow all but the last with a ","?
This may be outside the scope of loop as currently implemented, but i
can see it being useful.

chris

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



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



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


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





Reply via email to