You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Patrick <pa...@gmail.com> on 2010/03/13 00:09:34 UTC

variable from groovy to ftl file

I am modifying the order confirmation email, I've tracked it down to
the "orderstatus" screen.

<screen name="orderstatus"> <!-- truncated for brevity -->
  <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy"/>
  <html-template
location="component://ecommerce/webapp/ecommerce/order/orderstatus.ftl"/>
</screen>

basically OrderStatus.groovy loads up some variables which should be
available to the ftl file.

In the groovy file I've got this simple line
context.testname = "hello";

So then I try to access it in the FTL file. orderstatus.ftl with a simple
<#assign xx=testname>

But it says my variable is null.

Error on line 312, column 1 in
component://ecommerce/webapp/ecommerce/order/orderitems.ftl testname
is undefined. It cannot be assigned to xx The problematic instruction:
---------- ==> assignment: xx=testname [on line 312, column 1 in
component://ecommerce/webapp/ecommerce/order/orderitems

Seems like a pretty simple test, I must be missing something.  Any
tips are appreciated.
-patrick

Re: variable from groovy to ftl file

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
<#assign> tag should be closed.

For ex:
<#assign xx=testname/>

--
Ashish

On Sat, Mar 13, 2010 at 4:39 AM, Patrick <pa...@gmail.com> wrote:
> I am modifying the order confirmation email, I've tracked it down to
> the "orderstatus" screen.
>
> <screen name="orderstatus"> <!-- truncated for brevity -->
>  <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy"/>
>  <html-template
> location="component://ecommerce/webapp/ecommerce/order/orderstatus.ftl"/>
> </screen>
>
> basically OrderStatus.groovy loads up some variables which should be
> available to the ftl file.
>
> In the groovy file I've got this simple line
> context.testname = "hello";
>
> So then I try to access it in the FTL file. orderstatus.ftl with a simple
> <#assign xx=testname>
>
> But it says my variable is null.
>
> Error on line 312, column 1 in
> component://ecommerce/webapp/ecommerce/order/orderitems.ftl testname
> is undefined. It cannot be assigned to xx The problematic instruction:
> ---------- ==> assignment: xx=testname [on line 312, column 1 in
> component://ecommerce/webapp/ecommerce/order/orderitems
>
> Seems like a pretty simple test, I must be missing something.  Any
> tips are appreciated.
> -patrick
>

Re: variable from groovy to ftl file

Posted by Brajesh Patel <br...@gmail.com>.
Hi Patrick,
it will work,

in groovy : context.testname = "hello";
in ftl: <#assign xx=testname />

I think you are putting in side of the condition that is not satisfy.




On Sat, Mar 13, 2010 at 4:39 AM, Patrick <pa...@gmail.com>wrote:

> I am modifying the order confirmation email, I've tracked it down to
> the "orderstatus" screen.
>
> <screen name="orderstatus"> <!-- truncated for brevity -->
>  <script
> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy"/>
>  <html-template
> location="component://ecommerce/webapp/ecommerce/order/orderstatus.ftl"/>
> </screen>
>
> basically OrderStatus.groovy loads up some variables which should be
> available to the ftl file.
>
> In the groovy file I've got this simple line
> context.testname = "hello";
>
> So then I try to access it in the FTL file. orderstatus.ftl with a simple
> <#assign xx=testname>
>
> But it says my variable is null.
>
> Error on line 312, column 1 in
> component://ecommerce/webapp/ecommerce/order/orderitems.ftl testname
> is undefined. It cannot be assigned to xx The problematic instruction:
> ---------- ==> assignment: xx=testname [on line 312, column 1 in
> component://ecommerce/webapp/ecommerce/order/orderitems
>
> Seems like a pretty simple test, I must be missing something.  Any
> tips are appreciated.
> -patrick
>



-- 
Thanks
Brajesh Patel

HotWax Media
http://www.hotwaxmedia.com