On May 18, 2012, at 12:36 PM, mohit gupta wrote:
As i said in original post and as per my understanding
xwiki is using
groovy as scripting language where admin can write groovy scripts at run
time from UI which needs not not be compiled but Internally we are passing
this groovy script as string to server which is compiling it and executing
it at run time. In fact thats why it is called scripting language and
which seems to me the biggest advantage of groovy. Right?
This is the definition of a scripting languageā¦ :)
So this is true for all scripting languages. See the link I gave you in the previous
answer for the full list of scripting languages and how to choose one over another.
Thanks
-Vincent
---------- Forwarded message ----------
From: mohit gupta <motgupta(a)gmail.com>
Date: Fri, May 18, 2012 at 3:18 PM
Subject: Re: [xwiki-users] How end user can capitalize on groovy/velocity
fscript in xwiki?
To: XWiki Users <users(a)xwiki.org>
Thanks Caleb . Actually i am more interested in groovy usage in xwiki. If
you have any idea, can you comment on grrovy part of original post so that
i can use it in right sense.
On Fri, May 18, 2012 at 2:34 PM, Caleb James DeLisle <
calebdelisle(a)lavabit.com> wrote:
> Hi,
>
> I think of Velocity as a templating language.
> You can write:
> {{velocity}}
> Your username is $xcontext.getUser(), welcome to the site.
> {{/velocity}}
>
> Combining code and text in a natural way.
> You can even include XWiki markup in your velocity script since the output
> from velocity will go to the rendering engine.
>
> In groovy the same example would look like this:
>
> {{groovy}}
> println("Your username is " + xcontext.getUser() + " welcome to the
> site.");
> {{/groovy}}
>
> Also possible but not as easy.
> We usually use velocity for everything unless there is a compelling reason
> for
> groovy (there are some things such as the import keyword which are not
> available in velocity)
>
>
>
> Caleb
>
>
>
>
> On 05/18/2012 04:31 AM, mohit gupta wrote:
>> Hi all,
>>
>> i have seen xwiki can do lot of stuff with groovy and velocity.I am new
> to
>> groovy so trying to understand how groovy and velocty can benefit xwiki
> and
>> ultimately end user. As most of the site says groovy and java are almost
>> similar. so why xwiki is using groovy when it built upon java. As per my
>> understanding xwiki is using groovy as scripting language where admin can
>> write groovy scripts at run time from UI which needs not nto be compiled
>> but work like in the similar fashion to java. Internally we are passing
>> this grrovy script as string to server which is compilinh it and
> executing
>> it at run time. Right?
>>
>> Now second part is why velocity in xwiki? Velocity is used in similar
>> fashin to groovy in xwiki but difference is that any user without
>> programming rights also can write velocity scripts as it has access to
>> limited set of apis . Apart from that we can also write front end in
>> velocity script like if i write
>> {velocity}Hello:$xContext.getUser(){velocity} it will simply say
>> Hello:Scott on UI
>> but inside groovy scriplets everything will be taken as java code. Right?