You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Olivier Michel <ol...@gmail.com> on 2009/05/04 10:04:53 UTC
context object in Java ?
Hi all !
In the BeanShell code we have access to a map called "context" we can use to
put variables used therefter in the freemarker ftl files.
bsh: context.put("thisvariable", "value");
ftl: ${thisvariable}
Is there a way to get access to this map inside a Java code (for example in
an event, or in a call to the Java method inside the bsh) ?
I would like something like:
java:
Map mapContext = ????
...
mapContext.put("thisvariable", "value");
ftl: ${thisvariable}
Regards
Olivier Michel
Cypoint Systems Innovations AB
http://www.cypoint.se
Re: context object in Java ?
Posted by Olivier Michel <ol...@gmail.com>.
Thank you for your answer, Abdullah !
Simple and easy solution... I was searching too far.
Regards
Olivier
On Mon, May 4, 2009 at 1:57 PM, abdullah shaikh <abdullah.shaikh.1@gmail.com
> wrote:
> Hi Olivier,
>
> You can pass the context object to the java event/method from bsh and then
> access it in java.
>
> Regards,
> Abdullah
> Viithiisys
>
> On Mon, May 4, 2009 at 1:34 PM, Olivier Michel <olivier.michel@gmail.com
> >wrote:
>
> > Hi all !
> >
> > In the BeanShell code we have access to a map called "context" we can use
> > to
> > put variables used therefter in the freemarker ftl files.
> > bsh: context.put("thisvariable", "value");
> >
> > ftl: ${thisvariable}
> >
> > Is there a way to get access to this map inside a Java code (for example
> in
> > an event, or in a call to the Java method inside the bsh) ?
> >
> > I would like something like:
> > java:
> > Map mapContext = ????
> > ...
> > mapContext.put("thisvariable", "value");
> >
> > ftl: ${thisvariable}
> >
> >
> > Regards
> > Olivier Michel
> > Cypoint Systems Innovations AB
> > http://www.cypoint.se
> >
>
Re: context object in Java ?
Posted by abdullah shaikh <ab...@gmail.com>.
Hi Olivier,
You can pass the context object to the java event/method from bsh and then
access it in java.
Regards,
Abdullah
Viithiisys
On Mon, May 4, 2009 at 1:34 PM, Olivier Michel <ol...@gmail.com>wrote:
> Hi all !
>
> In the BeanShell code we have access to a map called "context" we can use
> to
> put variables used therefter in the freemarker ftl files.
> bsh: context.put("thisvariable", "value");
>
> ftl: ${thisvariable}
>
> Is there a way to get access to this map inside a Java code (for example in
> an event, or in a call to the Java method inside the bsh) ?
>
> I would like something like:
> java:
> Map mapContext = ????
> ...
> mapContext.put("thisvariable", "value");
>
> ftl: ${thisvariable}
>
>
> Regards
> Olivier Michel
> Cypoint Systems Innovations AB
> http://www.cypoint.se
>