velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "E.R. van Es" <e...@cdls.nl>
Subject Re: macro / parse problem on first run
Date Wed, 06 Jul 2005 12:01:53 GMT
Hi Simon,

  tested this right away and it works excellent, many thanks here.

Eric

On Wed, 6 Jul 2005 12:41:47 +0100
Simon Christian <simon@stoutstick.com> wrote:

> Hi Eric,
> 
> Your observations are correct, that the parsed-in macro won't be  
> available on the first request. If you want to use the macro within  
> multiple templates (as would typically be the case), you should add a  
> line to your velocity.properties file:
> 
>      velocimacro.library = macro.vm
> 
> Velocity will look for that file in your usual macro path(s). There  
> are further options, which you can read about within the developer  
> guide: http://jakarta.apache.org/velocity/developer-guide.html
> 
> - simon
> 
> On 6 Jul 2005, at 12:09, E.R. van Es wrote:
> 
> > Hello,
> >
> >   I use JBoss-4.0.1sp1 server, my application uses velocity-1.3.1.   
> > I use velocity to create the html pages, and have the following two  
> > templates:
> > (note: I simplified the code somewhat...)
> >
> > ------- macro.vm --------
> > #macro ( test $nr )
> >     $nr
> > #end
> > -------- end macro.vm -------
> >
> > ------- index.vm ---------
> > #parse("macro.vm")
> > <html>
> >     <body>
> > #test(1)
> > #test(2)
> >     </body>
> > </html>
> > ------ end index.vm -----
> >
> > Now I deploy this application on JBoss and open the index page  
> > through the servlet.  The very first time I open the page, I get  
> > this output:
> > --- output ----
> > #test(1)
> > #test(2)
> > --- end output ---
> >
> > now when I refresh the page, I get:
> > --- output ---
> > 1
> > 2
> > --- output ---
> >
> > so the first time it won't execute the macro...?  This only happens  
> > the first time opening the page after a new deployement.  When I  
> > copy the whole macro into the index.vm file it works, also the  
> > first time after deployement, but I need the macro in more files,  
> > so I want the macro in a seperate file.
> >
> > Looking forward to any reply,
> > Eric
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 

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


Mime
View raw message