How can I call groovy in ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I call groovy in ftl

Sumit Pandit-3
Hello All,

In my application the scenario is like :

In FTL I have a variable (say partyId),  now I need to access this  
variable in groovy file. There I extract more data from partyId and  
use that data in the calling FTL.

For this I perform following steps :-

In FTL I have partyID

a) set partyId in request.
b) Render a screen (which contain groovy file )
c) In groovy get the partyId from request
d) remove partyId from request
e) extract more data using partyId.
f) put data in the context
g) In ftl get data and do what i want.

Now I have some question

1) Is this approach correct ?
2) From FTL, can we call groovy directly ?
3) I am putting the partyId in request, is it right place in this  
context ?

please give some suggestion for this.

--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

Reply | Threaded
Open this post in threaded view
|

Re: How can I call groovy in ftl

Scott Gray
Hi Sumit

Why can't you just use groovy before you get to the template like we
do everywhere else?  Unless there is a special reason to do otherwise
we shouldn't be processing data in the templates just formatting it.

Regards
Scott

2008/10/11 Sumit Pandit <[hidden email]>:

> Hello All,
>
> In my application the scenario is like :
>
> In FTL I have a variable (say partyId),  now I need to access this variable
> in groovy file. There I extract more data from partyId and use that data in
> the calling FTL.
>
> For this I perform following steps :-
>
> In FTL I have partyID
>
> a) set partyId in request.
> b) Render a screen (which contain groovy file )
> c) In groovy get the partyId from request
> d) remove partyId from request
> e) extract more data using partyId.
> f) put data in the context
> g) In ftl get data and do what i want.
>
> Now I have some question
>
> 1) Is this approach correct ?
> 2) From FTL, can we call groovy directly ?
> 3) I am putting the partyId in request, is it right place in this context ?
>
> please give some suggestion for this.
>
> --
> Thanks and Regards
> Sumit Pandit.
> HotWaxMedia, Inc
> http://www.hotwaxmedia.com
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How can I call groovy in ftl

Sumit Pandit-3
Scott,

I need it in implementation of tree, and there is recursive calling of  
templet code via macro. In macro i get the partyId and then from it I  
need to get other related data.

The process I defined in mail is works fine for me. But I am not sure  
how feasible to use it in that way.


On Oct 10, 2008, at 5:45 PM, Scott Gray wrote:

> Hi Sumit
>
> Why can't you just use groovy before you get to the template like we
> do everywhere else?  Unless there is a special reason to do otherwise
> we shouldn't be processing data in the templates just formatting it.
>
> Regards
> Scott
>
> 2008/10/11 Sumit Pandit <[hidden email]>:
>> Hello All,
>>
>> In my application the scenario is like :
>>
>> In FTL I have a variable (say partyId),  now I need to access this  
>> variable
>> in groovy file. There I extract more data from partyId and use that  
>> data in
>> the calling FTL.
>>
>> For this I perform following steps :-
>>
>> In FTL I have partyID
>>
>> a) set partyId in request.
>> b) Render a screen (which contain groovy file )
>> c) In groovy get the partyId from request
>> d) remove partyId from request
>> e) extract more data using partyId.
>> f) put data in the context
>> g) In ftl get data and do what i want.
>>
>> Now I have some question
>>
>> 1) Is this approach correct ?
>> 2) From FTL, can we call groovy directly ?
>> 3) I am putting the partyId in request, is it right place in this  
>> context ?
>>
>> please give some suggestion for this.
>>
>> --
>> Thanks and Regards
>> Sumit Pandit.
>> HotWaxMedia, Inc
>> http://www.hotwaxmedia.com
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: How can I call groovy in ftl

Scott Gray
If it works I guess it's feasible but it still sounds a little
heavy/complicated.  Personally I still see no reason why the data
can't be prepared in full before you get to the template.  You could
build a list of maps with each map containing the data plus a child
list of maps.  If the data was made to be generic you could even reuse
the template to build any tree.

Regards
Scott

2008/10/11 Sumit Pandit <[hidden email]>:

> Scott,
>
> I need it in implementation of tree, and there is recursive calling of
> templet code via macro. In macro i get the partyId and then from it I need
> to get other related data.
>
> The process I defined in mail is works fine for me. But I am not sure how
> feasible to use it in that way.
>
>
> On Oct 10, 2008, at 5:45 PM, Scott Gray wrote:
>
>> Hi Sumit
>>
>> Why can't you just use groovy before you get to the template like we
>> do everywhere else?  Unless there is a special reason to do otherwise
>> we shouldn't be processing data in the templates just formatting it.
>>
>> Regards
>> Scott
>>
>> 2008/10/11 Sumit Pandit <[hidden email]>:
>>>
>>> Hello All,
>>>
>>> In my application the scenario is like :
>>>
>>> In FTL I have a variable (say partyId),  now I need to access this
>>> variable
>>> in groovy file. There I extract more data from partyId and use that data
>>> in
>>> the calling FTL.
>>>
>>> For this I perform following steps :-
>>>
>>> In FTL I have partyID
>>>
>>> a) set partyId in request.
>>> b) Render a screen (which contain groovy file )
>>> c) In groovy get the partyId from request
>>> d) remove partyId from request
>>> e) extract more data using partyId.
>>> f) put data in the context
>>> g) In ftl get data and do what i want.
>>>
>>> Now I have some question
>>>
>>> 1) Is this approach correct ?
>>> 2) From FTL, can we call groovy directly ?
>>> 3) I am putting the partyId in request, is it right place in this context
>>> ?
>>>
>>> please give some suggestion for this.
>>>
>>> --
>>> Thanks and Regards
>>> Sumit Pandit.
>>> HotWaxMedia, Inc
>>> http://www.hotwaxmedia.com
>>>
>>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How can I call groovy in ftl

Sumit Pandit-3
Scott,

I will try to implement what you suggest. Thank you very much for  
guidance.


--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

On Oct 11, 2008, at 1:39 AM, Scott Gray wrote:

> If it works I guess it's feasible but it still sounds a little
> heavy/complicated.  Personally I still see no reason why the data
> can't be prepared in full before you get to the template.  You could
> build a list of maps with each map containing the data plus a child
> list of maps.  If the data was made to be generic you could even reuse
> the template to build any tree.
>
> Regards
> Scott
>
> 2008/10/11 Sumit Pandit <[hidden email]>:
>> Scott,
>>
>> I need it in implementation of tree, and there is recursive calling  
>> of
>> templet code via macro. In macro i get the partyId and then from it  
>> I need
>> to get other related data.
>>
>> The process I defined in mail is works fine for me. But I am not  
>> sure how
>> feasible to use it in that way.
>>
>>
>> On Oct 10, 2008, at 5:45 PM, Scott Gray wrote:
>>
>>> Hi Sumit
>>>
>>> Why can't you just use groovy before you get to the template like we
>>> do everywhere else?  Unless there is a special reason to do  
>>> otherwise
>>> we shouldn't be processing data in the templates just formatting it.
>>>
>>> Regards
>>> Scott
>>>
>>> 2008/10/11 Sumit Pandit <[hidden email]>:
>>>>
>>>> Hello All,
>>>>
>>>> In my application the scenario is like :
>>>>
>>>> In FTL I have a variable (say partyId),  now I need to access this
>>>> variable
>>>> in groovy file. There I extract more data from partyId and use  
>>>> that data
>>>> in
>>>> the calling FTL.
>>>>
>>>> For this I perform following steps :-
>>>>
>>>> In FTL I have partyID
>>>>
>>>> a) set partyId in request.
>>>> b) Render a screen (which contain groovy file )
>>>> c) In groovy get the partyId from request
>>>> d) remove partyId from request
>>>> e) extract more data using partyId.
>>>> f) put data in the context
>>>> g) In ftl get data and do what i want.
>>>>
>>>> Now I have some question
>>>>
>>>> 1) Is this approach correct ?
>>>> 2) From FTL, can we call groovy directly ?
>>>> 3) I am putting the partyId in request, is it right place in this  
>>>> context
>>>> ?
>>>>
>>>> please give some suggestion for this.
>>>>
>>>> --
>>>> Thanks and Regards
>>>> Sumit Pandit.
>>>> HotWaxMedia, Inc
>>>> http://www.hotwaxmedia.com
>>>>
>>>>
>>
>>