commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thakkar, Hetal" <hetal.thak...@citigroup.com>
Subject RE: while constructs
Date Wed, 27 Aug 2003 15:08:47 GMT
Hi,

ForEach worked. While does not work even with the suggested
modifications.

Thanks,
Hetal

-----Original Message-----
From: Beer, Christian [mailto:Christian.Beer@Diron.DE]
Sent: Tuesday, August 26, 2003 11:14 PM
To: commons-user@jakarta.apache.org
Subject: RE: while constructs


Hi!

> > <j:set var="iterations" value="${3}"/>	          	
> > <j:while test="${iterations} > 0">
> > 	<j:set var="iterations" value="${iterations - 1 }"/>
> > 	<log:info>${iterations}</log:info>
> > </j:while>

I think there are some little things in that construct:

> > <j:set var="iterations" value="${3}">

Should be <j:set var="iterations" value="3"> because '3' is no variable.
(maybe ${3} also works, but that is a little bit of an overkill.)

> > <j:while test="${iterations} > 0">

this should be <j:while test="${iterations &gt; 0}"> because the whole
test-expression must be included in {} and > is an xml-keyword.

I for myself would use 

<j:forEach var="it" begin="1" end="3">
  <j:set var="iterations" value="${4 - it}"/>
  <log:info>${iterations}</log:info>
</j:forEach>
(forEach taken from jstl-doku but I think it's the same as in jelly!)


Greetings,

Christian

> -----Original Message-----
> From: Thakkar, Hetal [mailto:hetal.thakkar@citigroup.com] 
> Sent: Tuesday, August 26, 2003 5:15 PM
> To: Jakarta Commons Users List
> Subject: RE: while constructs
> 
> 
> Paul,
> 
> Both of those variations don't make any difference.
> 
> Thanks,
> Hetal
> 
> -----Original Message-----
> From: Paul Libbrecht [mailto:paul@activemath.org]
> Sent: Monday, August 25, 2003 2:37 PM
> To: Jakarta Commons Users List
> Subject: Re: while constructs
> 
> 
> Thakkar, Hetal wrote:
> > I am trying to use while. But unfortunately, I could not find any
> example on Jelly's website. Could anyone let me know, how 
> "while" constuct works in Jelly? 
> > 
> > I tried the following but it does not work:
> > 
> > <j:set var="iterations" value="${3}"/>	          	
> > <j:while test="${iterations} > 0">
> > 	<j:set var="iterations" value="${iterations - 1 }"/>
> > 	<log:info>${iterations}</log:info>
> > </j:while>
> 
> Hetal,
> 
> I would either use
>   test="iterations > 0"
> 
> or
>   test="${iterations > 0}"
> 
> but I think the first is correct...
> 
> Paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

Mime
View raw message