You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Hessu X <he...@yahoo.com> on 2006/08/26 10:28:32 UTC

Velocity as a Ant build file generator /preprocessor (standalone)

Hello,

I am considering to use velocity to generate my ant XML build files (not for building).
I understood that velocity is server side software but I am not able to use it that way.

Is there possibility to run velocity as a standalone ?
Is there anything special I need to know?
Is Velocity the best solution for my problem? -: Any other possibilities...

Thank you all beforehand!



 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.

Re: Are inline macros cached somewhere?

Posted by Nathan Bubna <nb...@gmail.com>.
Limiting yourself to just one velocimacro for both situations isn't a
bad idea.  :)

You might also try these settings:

velocimacro.permissions.allow.inline = true
velocimacro.permissions.allow.inline.to.replace.global = false
velocimacro.permissions.allow.inline.local.scope = true

I believe that will keep your #requestItemActions macro local to their
defining templates, but i think (not 100% sure at the moment) the
mechanics of #parse means the macro will also be available to
templates parsed by the template that defines #requestItemActions.  If
not, then try this:

velocimacro.permissions.allow.inline = true
velocimacro.permissions.allow.inline.to.replace.global = true
velocimacro.permissions.allow.inline.local.scope = false

This is inefficient and not really recommended, since it keeps
replacing the global #requestItemActions every time, but i think it
should also work.

Read more on these at
http://jakarta.apache.org/velocity/docs/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values


On 8/28/06, Matthias Hendler <ma...@siv.de> wrote:
> Hello,
>
> I think that in velocity all macros have a global scope.
> So whenever you define a macro it will by put in this global area. And I
> would expect that velocity doesn't parse an "already known" macro twice
> for performance reasons.
>
> What can you do?
> Define one macro with a second parameter to determine the scope
> (user/vendor).
> Before the parse you set a global variable which helds the actual scope.
> In your RequestView you call the macro with this global variable.
> Define a macro like:
>
> #macro( requestAction $id $scope )
> #if ("user".equals($scope)
>         <user actions>
> #else
>         <vendor actions>
> #end
> #end
>
>
> In your user view:
> #set ($GlobalActualScope = "user")
> #parse("includes/requestView.vm")
>
> In your requestView call the macro like:
> requestAction $actualId $GlobalActualScope
>
>
> Waiting for an expert what he says. ;-)
> Matthias
>
>
>
> Anton Tonchev schrieb:
>
> >Hello!
> >
> >I have the following problem:
> >
> >I have two pages userRequests.vm and vendorRequests.vm.
> >
> >The first one has userRequests.vm:
> >#macro( requestItemActions $requestId )
> >        <user specific actions>
> >#end
> >#parse("includes/requestView.vm")
> >-----------------
> >
> >And the second one vendorRequests.vm:
> >#macro( requestItemActions $requestId )
> >        <vendor specific actions>
> >#end
> >#parse("includes/requestView.vm")
> >------------------
> >
> >The file that is included (includes/requestView.vm) contains an
> >interation over some items and calls the macro requestItemActions for
> >each item.
> >
> >The problem is that the inline defined macro is somewhat cached
> >because after the first parse of the temlate it is remambered and in
> >both pages (vendorRequest.vm and userRequest.vm) is used the same
> >template.
> >
> >Do you have any idea why it is not working?
> >
> >I tried with the
> >velocimacro.permissions.allowInlineToOverride=true
> >but it still isn't working.
> >
> >Thanks in advance.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> >
> >
>
>
> --
> Mit freundlichen Grüßen
>
> Matthias Hendler
>
> Technologie
>
> SIV.AG
> Konrad-Zuse-Str. 1
> 18184 Roggentin
>
> Telefon: +49 (0)3 81 / 25 24 - 0
> Telefax: +49 (0)3 81 / 25 24 - 4 99
>
>
>
>
> mailto:matthias.hendler@siv.de
> http://www.siv.de
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity
> to whom they are addressed. The views expressed in this
> e-mail are those of the individual author and not necessarily
> those of SIV.AG.
>
> This footnote also confirms that this email message has
> been swept by serval anti-virus tools for the presence
> of computer viruses.
> *********************************************************************
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Are inline macros cached somewhere?

Posted by Matthias Hendler <ma...@siv.de>.
Hello,

I think that in velocity all macros have a global scope.
So whenever you define a macro it will by put in this global area. And I 
would expect that velocity doesn't parse an "already known" macro twice 
for performance reasons.

What can you do?
Define one macro with a second parameter to determine the scope 
(user/vendor).
Before the parse you set a global variable which helds the actual scope.
In your RequestView you call the macro with this global variable.
Define a macro like:

#macro( requestAction $id $scope )
#if ("user".equals($scope)
	<user actions>
#else
	<vendor actions>
#end
#end


In your user view:
#set ($GlobalActualScope = "user")
#parse("includes/requestView.vm")

In your requestView call the macro like:
requestAction $actualId $GlobalActualScope


Waiting for an expert what he says. ;-)
Matthias



Anton Tonchev schrieb:

>Hello!
>
>I have the following problem:
>
>I have two pages userRequests.vm and vendorRequests.vm.
>
>The first one has userRequests.vm:
>#macro( requestItemActions $requestId )
>        <user specific actions>
>#end
>#parse("includes/requestView.vm")
>-----------------
>
>And the second one vendorRequests.vm:
>#macro( requestItemActions $requestId )
>        <vendor specific actions>
>#end
>#parse("includes/requestView.vm")
>------------------
>
>The file that is included (includes/requestView.vm) contains an
>interation over some items and calls the macro requestItemActions for
>each item.
>
>The problem is that the inline defined macro is somewhat cached
>because after the first parse of the temlate it is remambered and in
>both pages (vendorRequest.vm and userRequest.vm) is used the same
>template.
>
>Do you have any idea why it is not working?
>
>I tried with the
>velocimacro.permissions.allowInlineToOverride=true
>but it still isn't working.
>
>Thanks in advance.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>  
>


-- 
Mit freundlichen Grüßen

Matthias Hendler

Technologie

SIV.AG
Konrad-Zuse-Str. 1
18184 Roggentin

Telefon: +49 (0)3 81 / 25 24 - 0
Telefax: +49 (0)3 81 / 25 24 - 4 99




mailto:matthias.hendler@siv.de
http://www.siv.de



**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity
to whom they are addressed. The views expressed in this
e-mail are those of the individual author and not necessarily
those of SIV.AG.

This footnote also confirms that this email message has
been swept by serval anti-virus tools for the presence
of computer viruses.
*********************************************************************




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


Are inline macros cached somewhere?

Posted by Anton Tonchev <to...@xi-tec.com>.
Hello!

I have the following problem:

I have two pages userRequests.vm and vendorRequests.vm.

The first one has userRequests.vm:
#macro( requestItemActions $requestId )
        <user specific actions>
#end
#parse("includes/requestView.vm")
-----------------

And the second one vendorRequests.vm:
#macro( requestItemActions $requestId )
        <vendor specific actions>
#end
#parse("includes/requestView.vm")
------------------

The file that is included (includes/requestView.vm) contains an
interation over some items and calls the macro requestItemActions for
each item.

The problem is that the inline defined macro is somewhat cached
because after the first parse of the temlate it is remambered and in
both pages (vendorRequest.vm and userRequest.vm) is used the same
template.

Do you have any idea why it is not working?

I tried with the
velocimacro.permissions.allowInlineToOverride=true
but it still isn't working.

Thanks in advance.


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


Re: [HELP] I'm looking for one text editor for Velocity

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
I got the answer: tinymce :)
----- Original Message ----- 
From: "Pham Anh Tuan" <an...@ichi-corp.jp>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Tuesday, August 29, 2006 7:57 AM
Subject: Re: [HELP] I'm looking for one text editor for Velocity


> sorry all, I mean html editor :(
>
> plz help me!
> ----- Original Message ----- 
> From: "Will Glass-Husain" <wg...@forio.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Monday, August 28, 2006 9:11 PM
> Subject: Re: [HELP] I'm looking for one text editor for Velocity
>
>
> I use Eclipse with one of the Velocity plugins or TextPad (with a
> Velocity syntax extension).  The first does auto-completion and error
> checking, the second just syntax highlighting.
>
>
>
> On 8/28/06, Hessu X <he...@yahoo.com> wrote:
>> At least Ecplipse, JEdit & emacs
>>
>> http://wiki.apache.org/jakarta-velocity/VelocityEditors
>>
>>
>> Pham Anh Tuan <an...@ichi-corp.jp> wrote: Hi all,
>>
>> I got a problem in seeking one text editor using in Velocity, I tried to 
>> use
>> FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but 
>> it's
>> text editor can't specify cols and rows :( ... help me plz
>>
>> thanks in advance.
>>
>> bowlkhin
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>>
>>
>> ---------------------------------
>> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great 
>> rates starting at 1¢/min.
>>
>
>
> -- 
> Forio Business Simulations
>
> Will Glass-Husain
> wglass@forio.com
> www.forio.com
>
> ---------------------------------------------------------------------
> 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


Re: [HELP] I'm looking for one text editor for Velocity

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
sorry all, I mean html editor :(

plz help me!
----- Original Message ----- 
From: "Will Glass-Husain" <wg...@forio.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Monday, August 28, 2006 9:11 PM
Subject: Re: [HELP] I'm looking for one text editor for Velocity


I use Eclipse with one of the Velocity plugins or TextPad (with a
Velocity syntax extension).  The first does auto-completion and error
checking, the second just syntax highlighting.



On 8/28/06, Hessu X <he...@yahoo.com> wrote:
> At least Ecplipse, JEdit & emacs
>
> http://wiki.apache.org/jakarta-velocity/VelocityEditors
>
>
> Pham Anh Tuan <an...@ichi-corp.jp> wrote: Hi all,
>
> I got a problem in seeking one text editor using in Velocity, I tried to 
> use
> FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but 
> it's
> text editor can't specify cols and rows :( ... help me plz
>
> thanks in advance.
>
> bowlkhin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great 
> rates starting at 1¢/min.
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

---------------------------------------------------------------------
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


Re: [HELP] I'm looking for one text editor for Velocity

Posted by Will Glass-Husain <wg...@forio.com>.
I use Eclipse with one of the Velocity plugins or TextPad (with a
Velocity syntax extension).  The first does auto-completion and error
checking, the second just syntax highlighting.



On 8/28/06, Hessu X <he...@yahoo.com> wrote:
> At least Ecplipse, JEdit & emacs
>
> http://wiki.apache.org/jakarta-velocity/VelocityEditors
>
>
> Pham Anh Tuan <an...@ichi-corp.jp> wrote: Hi all,
>
> I got a problem in seeking one text editor using in Velocity, I tried to use
> FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but it's
> text editor can't specify cols and rows :( ... help me plz
>
> thanks in advance.
>
> bowlkhin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1¢/min.
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

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


Re: [HELP] I'm looking for one text editor for Velocity

Posted by Hessu X <he...@yahoo.com>.
At least Ecplipse, JEdit & emacs

http://wiki.apache.org/jakarta-velocity/VelocityEditors


Pham Anh Tuan <an...@ichi-corp.jp> wrote: Hi all,

I got a problem in seeking one text editor using in Velocity, I tried to use 
FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but it's 
text editor can't specify cols and rows :( ... help me plz

thanks in advance.

bowlkhin 



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



 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1¢/min.

[HELP] I'm looking for one text editor for Velocity

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
Hi all,

I got a problem in seeking one text editor using in Velocity, I tried to use 
FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but it's 
text editor can't specify cols and rows :( ... help me plz

thanks in advance.

bowlkhin 



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


Re: Velocity as a Ant build file generator /preprocessor (standalone)

Posted by dizzi <di...@logout.sh.cvut.cz>.
Its not server side software only :)

http://jakarta.apache.org/velocity/docs/developer-guide.html#Using%20Velocity%20In%20General%20Applications

check this :)
I think that it answers most of your questions.

d.


On Sat, 26 Aug 2006 10:28:32 +0200, Hessu X <he...@yahoo.com> wrote:

> Hello,
>
> I am considering to use velocity to generate my ant XML build files (not  
> for building).
> I understood that velocity is server side software but I am not able to  
> use it that way.
>
> Is there possibility to run velocity as a standalone ?
> Is there anything special I need to know?
> Is Velocity the best solution for my problem? -: Any other  
> possibilities...
>
> Thank you all beforehand!
>
>
>
>  		
> ---------------------------------
> Do you Yahoo!?
>  Get on board. You're invited to try the new Yahoo! Mail.



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