context object in Java ?

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

context object in Java ?

Olivier Michel-4
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
Reply | Threaded
Open this post in threaded view
|

Re: context object in Java ?

Abdullah Shaikh
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 <[hidden email]>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
>
Reply | Threaded
Open this post in threaded view
|

Re: context object in Java ?

Olivier Michel-4
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 <[hidden email]
> 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 <[hidden email]
> >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
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: context object in Java ?

BJ Freeman
In reply to this post by Olivier Michel-4
do a search of java code for the word context
this is used to pass data when a service is defined in java.
the request in the java that uses events also has this type of information.
when i say events I am speaking of the ofbiz events that are defined in
 the controller not java events.
you can get a good idea of how things are extracted and placed.



Olivier Michel sent the following on 5/4/2009 1:04 AM:

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

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: context object in Java ?

Mahesh Bachchan
In reply to this post by Olivier Michel-4
I´m sorry, but I don´t understand the solution :-/

Do you have a example for me :-)

Thanks
Yours Mahesh


>
> On Mon, May 4, 2009 at 1:57 PM, abdullah shaikh <
> [hidden email]
> > 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 <[hidden email]
> > >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<https://freemailng6304.web.de/jump.htm?goto=http%3A%2F%2Fwww.cypoint.se>
> > >
> >
Reply | Threaded
Open this post in threaded view
|

Re: context object in Java ?

Mahesh Bachchan
In reply to this post by Olivier Michel-4
Hello,

I´m sorry, but I don´t understand the solution :-/

Do you have a example for me :-)

Thanks
Yours Mahesh




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 <[hidden email]
> 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 <[hidden email]
> >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<https://freemailng6304.web.de/jump.htm?goto=http%3A%2F%2Fwww.cypoint.se>
> >
>