You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Coast <na...@codeczar.com> on 2003/09/19 10:51:25 UTC

looping with
Hi,

I test for a condition within a loop using the <ant:available tag

<j:forEach var="lib" items="${pom.artifacts}">
    <j:set var="dep" value="${lib.dependency}"/>
    <j:set var="junitejb.test.jar" value="${dep....}"/>
    <ant:available property="junitejb.test.jar.available"
	file="${junitejb.test.jar}"/>
    <j:if test="${junitejb.test.jar.available}">
	do something with the file
    </j:if>
</j:forEach>

if junit.test.jar.available is set to true it is never reset to false or 
null.  If the available is false, the property is left in whatever state 
it is currently in.

any ideas for a workaround as I guess I'm stuck with how ant works.

cheers
Nathan





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


Re: looping with Posted by khote <kh...@mminternet.com>.
hey!  that's a maven question.  You are setting a variable to flag whether
or not that jar is in the dependencies ...?
you may have to add the type="file" ...
sometimes you have to use your reverse boolean logic to get the !ORS to work
as !(this AND that)

I found sometimes for those available tests that you have to test against
"true" as well as test for empty()
  <ant:available property="testJarPresent" type="file"
file="${junitejb.test.jar"/>
  <j:if test="${empty(testJarPresent) or
testJarPresent.trim().equals('true')}" >
   ... do stuff it if isn't there
  </j:if>

----- Original Message ----- 
From: "Nathan Coast" <na...@codeczar.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, September 19, 2003 1:51 AM
Subject: looping with <ant:available


> Hi,
>
> I test for a condition within a loop using the <ant:available tag
>
> <j:forEach var="lib" items="${pom.artifacts}">
>     <j:set var="dep" value="${lib.dependency}"/>
>     <j:set var="junitejb.test.jar" value="${dep....}"/>
>     <ant:available property="junitejb.test.jar.available"
> file="${junitejb.test.jar}"/>
>     <j:if test="${junitejb.test.jar.available}">
> do something with the file
>     </j:if>
> </j:forEach>
>
> if junit.test.jar.available is set to true it is never reset to false or
> null.  If the available is false, the property is left in whatever state
> it is currently in.
>
> any ideas for a workaround as I guess I'm stuck with how ant works.
>
> cheers
> Nathan
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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