Re: Fw: logic:iterate how to test the 1st and last iteration ?

2007-05-02 Thread piloupy GOTTAPIL

Sorry guys, I don't know why the mailer tells me that my mail is spam...

I've answered 3 times to give the solution using the JSTL Core, but
the mailer blocked them. I think it's because of the code that I put.

---
This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

   user@struts.apache.org

Technical details of permanent failure:
PERM_FAILURE: SMTP Error (state 12): 552 spam score (5.5) exceeded threshold

(etc...)
---

piloupy

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



Fw: logic:iterate how to test the 1st and last iteration ?

2007-04-27 Thread Martin Gainty
Tim 
for 2.x use the 
ww:iterator 
 ww:if test=#foo=bar

http://struts.apache.org/2.x/docs/iteration-tags.html

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: Tim B [EMAIL PROTECTED]

To: user@struts.apache.org
Sent: Friday, April 27, 2007 9:09 PM
Subject: Re: logic:iterate how to test the 1st and last iteration ?




piloupy GOTTAPIL [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Hi,

What I want to do is quite simple. I'd like to know how to test in a
logic:iterate when I'm at the first or last iteration.

My present problem is to parse a collection of String and display the
results like this :

### CODE : begin ###
value1, value2, value3
### CODE : end ###

And as you can see, for the last iteration, I mustn't displey the
comma character.

My present code is :

### CODE : begin ###
logic:iterate id=e name=myCollection
  bean:write name=e property=name /,
/logic:iterate
### CODE : end ###

Thanks in advance :)

piloupy



how about using the length and offset attributes like so:

!--display first item of list with no comma--
logic:iterate id=e name=myCollection length=1
 bean:write name=e property=name /
/logic:iterate

!--display remaining items of list with a  comma and space prepended to
each-- 
logic:iterate id=e name=myCollection offset=1
 , bean:write name=e property=name /
/logic:iterate




-
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]