velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@adeptra.com>
Subject Re: Using #stop
Date Thu, 21 Nov 2002 20:13:10 GMT

On Thursday, November 21, 2002, at 12:43 PM, Rodrigo Reyes wrote:

> Hi
>     Is there any way to stop the template execution at any point? I 
> tried
> using #stop, but it gives me an error. Here is the code I used:
>
> #foreach($root in $roots)
>  #if($queryexecuter.isEmptyElement($root))
>   #stop
>  #end
> #end
>
>     What am I doing wrong? Thanx
>

Nathan already answered about #stop, but I'll suggest another solution.

If you want to stop rendering, one suggestion is to use a tool with a 
method  that will throw an exception.

You can catch it during rendering

   try
   {
        template.merge(....);
   }
   catch(StopRenderingTemplateException srte)
   {
       ...
   }

-- 
Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)
geirm@adeptra.com


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


Mime
View raw message