commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [Jelly]BreakTag
Date Thu, 24 Oct 2002 06:59:40 GMT
Hi Vinay

I've finally gotten around to adding a BreakTag. The original patch modified
the Script objects, which are the static parsed image of a script and can be
cached and reused across threads. I changed the implementation to use
exception throwing to break out of loops. So to terminate from a <forEach>
or <while> loop, something just needs to throw a BreakException.

Thanks for the patch Vinay, its all applied to CVS HEAD now.

James
-------
http://radio.weblogs.com/0112098/

----- Original Message -----
From: "Vinay Chandran" <sahilvinay@yahoo.com>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Sunday, October 13, 2002 4:53 AM
Subject: [Jelly]BreakTag


> Hi,
>
> [Attached BreakTag.java]
>
> BreakTag [ <break if="condition"/> ] tag allows one to
> conditionally
> break out of a script block without executing any
> subsequent scripts within its parent .
> The natural use is to break out of a <foreach/> ,
> <while/> loop .
> Break works in the context of any parent tag and thus
> one can use
> to conditionaly break out of the entire script itself.
> [ testBreak.jelly attached ]
>
> Regards,
> Vinay.
>
> Patch to CoreTagLibrary
> ------------------------
> 97a98
> > registerTag("break",BreakTag.class);
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos & More
> http://faith.yahoo.com


----------------------------------------------------------------------------
----


> <?xml version="1.0"?>
>
> <!-- displays the current command line arguments -->
>
>
> <j:jelly xmlns:j="jelly:core">
>
> <!-- Setting a boolean var to true -->
> <j:set var="exitCompletely" value="true"/>
>
> <arguments>
>   <j:forEach var="arg" items="${args}" begin="1">
>       <!-- Break cond for the foreach loop -->
>       <j:break if='${arg=="three"}'/>
>       <argument>${arg}</argument>
>   </j:forEach>
> </arguments>
>
> <j:break if='${exitCompletely}'/>
> **************************
> These Should NOT  appear
> **************************
> </j:jelly>
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message