Re: Expression Handling Again
Dan Miller <[email protected]> Thu, 22 Sep 2005 09:22:22 -0700 (PDT)
| Newsgroups | gmane.comp.java.webmacro.user |
|---|---|
| Message-ID | <[email protected]> |
I guess what I was wondering about was using the api directly stepping in before the #set places the result into the context. I was looking into the src for PropertyMethod and trying to figure out how to get the result. I am using webmacro throughout a webproject, and would like to use similiar webmacro expression in xml files which are read and processed. Thanks --- Keats Kirsch <[email protected]> wrote: > AFAIK there are only two ways to get something out > of a WM template > expansion -- capture the result of the expansion, or > pull something from > the context. Actually I suppose you could use the > #bean directive to > create a "global" variable and then get it from the > Broker. > > Maybe if you can explain your requirements we could > think of a way of > doing what you want. > > Keats > > Dan Miller wrote: > > >The usage of the StringMacro to use the #set > directive > >works great. I was wondering if there is anything > >exposed to evaluate the expression without > modifying > >the context. > > > >This works great, but I would like to leave the > >context as is, not adding new temp variables to the > >context. > > > >Context ctx = new Context(); > >ctx.put("val1", 1); > >ctx.put("val2", 155); > >Macro macro = null; > >macro = new StringMacro("#set $val = $val1 + > $val2"); > >macro.evaluate( ctx); > >Integer val = (Integer)ctx.get("val"); > > > > > >I am looking forward to the 2.0 release. > > > > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's > Geronimo App Server. Download > it for free - -and be entered to win a 42" plasma tv > or your very own > Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > _______________________________________________ > Webmacro-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/webmacro-user > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php