You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
(68) |
Dec
(77) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(75) |
Feb
(84) |
Mar
(89) |
Apr
(96) |
May
(52) |
Jun
(73) |
Jul
(99) |
Aug
(46) |
Sep
(40) |
Oct
(46) |
Nov
(45) |
Dec
(25) |
| 2004 |
Jan
(13) |
Feb
(74) |
Mar
(40) |
Apr
(18) |
May
(31) |
Jun
(1) |
Jul
(16) |
Aug
(1) |
Sep
(21) |
Oct
(19) |
Nov
(10) |
Dec
(16) |
| 2005 |
Jan
(4) |
Feb
(12) |
Mar
(46) |
Apr
(33) |
May
(64) |
Jun
(1) |
Jul
(60) |
Aug
(31) |
Sep
(26) |
Oct
(24) |
Nov
(37) |
Dec
(10) |
| 2006 |
Jan
(3) |
Feb
(31) |
Mar
(122) |
Apr
(22) |
May
(4) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(8) |
Nov
(3) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(8) |
|
From: Marcello H <mar...@gm...> - 2005-10-18 04:52:27
|
The #setprops directive would also be nice if the data is really coming
out of a property file; something like
#setprops as file "myprops.ini"
It would do the same as if the properties where typed in between your
accolades '{ .... }' and of course the content needs to get parsed, so
that the Type =3D $User.TYPE_STANDARD still works.
BTW the directive isn't mentioned in the directive page! (Hint)
I'm not that busy with Webmacro at this moment but want to thank you for
this enhancement. This keeps the project alive and kicking!
Keep up the good work everybody!
2005/10/17, Keats Kirsch <ke...@xa...>:
> I have (finally) committed the SetpropsDirective (fka
> PropertiesDirective).
>
> Documentation can be found at http://www.webmacro.org/SetpropsDirective.
>
> Unit tests can be found in org.webmacro.template.TestSetpropsDirective.ja=
va.
>
> As part of this effort, I also refactored the BeanDirective, allowing
> both classes to share a class loading mechanism that supports the
> AllowedPackages and ImpliedPackages configuration properties. (Other
> directive can also use this feature by invoking the
> org.webmacro.util.Instantiator class.) I have deprecated the
> BeanDirective prefix for these properties, so you should now just
> specify them like:
>
> AllowedPackages=3Djava.util,org.webmacro.util
> ImpliedPackages=3Djava.util,org.webmacro,org.webmacro.util
>
> Please try this out and give me feedback.
>
> Keats
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Webmacro-user mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
|
|
From: Lane S. <la...@op...> - 2005-10-18 04:50:57
|
This is great news. I am planning on releasing WM as a buildable release that includes the body of the WebMacro tests. The release will be at once testable and useable out of the box. People like running the tests for a product to develop familiarity and confidence in the software. Lane Keats Kirsch wrote: > I have (finally) committed the SetpropsDirective (fka > PropertiesDirective). > Documentation can be found at http://www.webmacro.org/SetpropsDirective. > > Unit tests can be found in > org.webmacro.template.TestSetpropsDirective.java. > > As part of this effort, I also refactored the BeanDirective, allowing > both classes to share a class loading mechanism that supports the > AllowedPackages and ImpliedPackages configuration properties. (Other > directive can also use this feature by invoking the > org.webmacro.util.Instantiator class.) I have deprecated the > BeanDirective prefix for these properties, so you should now just > specify them like: > > AllowedPackages=java.util,org.webmacro.util > ImpliedPackages=java.util,org.webmacro,org.webmacro.util > > Please try this out and give me feedback. > > Keats > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Webmacro-user mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webmacro-user > -- Lane Sharman Providing Private and SPAM-Free Email http://www.opendoors.com 858-755-2868 |
|
From: Keats K. <ke...@xa...> - 2005-10-17 05:15:07
|
I have (finally) committed the SetpropsDirective (fka PropertiesDirective). Documentation can be found at http://www.webmacro.org/SetpropsDirective. Unit tests can be found in org.webmacro.template.TestSetpropsDirective.java. As part of this effort, I also refactored the BeanDirective, allowing both classes to share a class loading mechanism that supports the AllowedPackages and ImpliedPackages configuration properties. (Other directive can also use this feature by invoking the org.webmacro.util.Instantiator class.) I have deprecated the BeanDirective prefix for these properties, so you should now just specify them like: AllowedPackages=java.util,org.webmacro.util ImpliedPackages=java.util,org.webmacro,org.webmacro.util Please try this out and give me feedback. Keats |
|
From: Sven S. <sv...@sc...> - 2005-10-06 08:39:31
|
Thank you Keats and thank you Nick for your answers. I also thought about a kind of "Interceptor" for determining the template name before telling webmacro to fetch it. I just wanted to do this as transparent as possible for the user. So I probably have to use a custom include-directive. Thanks for your help! |
|
From: Nick S. <NSa...@ms...> - 2005-10-05 08:38:32
|
Hi
We do much the same thing but we use a simple interceptor context
tool.
We use an internationaliastion service to populate the context with a
language key
and then always use a call to the tool to find internationalised
templates.
eg
#include as template "$Paths.template("myResource.wmt",$DEFAULT_PATH))
where $DEFAULT_PATH is usuallly "en"
The tool caches the existing found paths for speed.
So if the site is in French you would get "fr/myResource.wmt" and so on
or if that didn't exist it would default to "en/myResource.wmt"
We use versions of the same tool for javascript,images,stylesheets
etc.
Regards
Nick
>>> ke...@xa... 10/04/05 09:23pm >>>
Sorry Sven. I'm afraid I don't quite understand what you are trying to
do and what isn't working. I'm pretty sure that the caching mechanism
is based on the template name, including the path, so you'll need to
determine the path before you attempt to retrieve the template.
If you give some more detail and maybe some code, we can try to be of
more help. It does sound like a very worthwhile project.
Keats
Sven Schliesing wrote:
> No answer? Is the webmacro-community dead? Or just this list?
>
> Sven Schliesing wrote:
>
>> Hi,
>>
>> I just finished my custom template loader for webmacro. Goal of it
is
>> context-based template loading and internationalization . It takes a
>> template name ("index" for example), determines the directory where
>> the appropriate version resides and adds an internationalization
suffix.
>
> ...
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Webmacro-user mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads,
discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Webmacro-user mailing list
Web...@li...
https://lists.sourceforge.net/lists/listinfo/webmacro-user
This mail has been checked at MSXI for all known virus'.
You open this at your own risk. Please make sure all replies are virus free.
Also, we do not accept or send attachments of the type exe, vbs, scr or bat due to the increased virus risk they contain.
These types of attachments will be stripped from the message.
MSXI
|
|
From: Keats K. <ke...@xa...> - 2005-10-04 20:23:36
|
Sorry Sven. I'm afraid I don't quite understand what you are trying to
do and what isn't working. I'm pretty sure that the caching mechanism
is based on the template name, including the path, so you'll need to
determine the path before you attempt to retrieve the template.
If you give some more detail and maybe some code, we can try to be of
more help. It does sound like a very worthwhile project.
Keats
Sven Schliesing wrote:
> No answer? Is the webmacro-community dead? Or just this list?
>
> Sven Schliesing wrote:
>
>> Hi,
>>
>> I just finished my custom template loader for webmacro. Goal of it is
>> context-based template loading and internationalization . It takes a
>> template name ("index" for example), determines the directory where
>> the appropriate version resides and adds an internationalization suffix.
>
> ...
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Webmacro-user mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
|
|
From: Sven S. <sv...@sc...> - 2005-10-04 17:03:50
|
No answer? Is the webmacro-community dead? Or just this list?
Sven Schliesing wrote:
> Hi,
>
> I just finished my custom template loader for webmacro. Goal of it is
> context-based template loading and internationalization . It takes a
> template name ("index" for example), determines the directory where the
> appropriate version resides and adds an internationalization suffix.
...
|
|
From: Lane S. <la...@op...> - 2005-10-04 16:45:24
|
WebMacro Release 2 Experts: If you have been using #setblock, #eval, #bean and #templet, please send me snippets in text files that can be included in the new examples/release2 directory I am working on. Please do it now. This is really an important part of the upcoming distro: release 2 features in action. thanks, -- Lane Sharman Providing Private and SPAM-Free Email http://www.opendoors.com 858-755-2868 |
|
From: Keats K. <ke...@xa...> - 2005-09-27 15:32:42
|
I'm curious about this benchmarking result. I can't figure out where
the savings would come from unless it is a trivial template. AFAICT the
only step that gets skipped is the the hash lookup which should be
fast. You still have to create the context, load the context, parse the
template, and expand the template. I suppose if the template is cached
and the context is reused as well and the template is simple, then it
would make sense.
There is probably some room for optimizing this even further ... a tool
to evaluate a WM expression without any output buffer (NullFastwriter?)
or even creating a variable. Hmmm ...
Keats
Eric B. Ridge wrote:
> On Sep 22, 2005, at 5:27 PM, Keats Kirsch wrote:
>
>> Eric's method is nice.
>
>
> It's also really fast. On the order of 20% faster than communicating
> the value through the Context. Which is important if you're doing
> this sort of thing over and over in web-requests.
>
> eric
>
>> I do something similar (though less elegant) in the
>> PropertiesDirective. However for XML files there is a much simpler
>> method that I sometimes use: just parse the XML file as a template
>> before you parse the XML. Works great.
>>
>> You can use doubles in WMScript, but not natively with the built-in
>> operators. You can use the $Math tool and the casting functions,
>> like $toDouble.
>>
>> Keats
>>
>> Dan Miller wrote:
>>
>>
>>> That method works great to get the result. One last
>>> thing, how come webmacro expressions do not return
>>> double. Is that historical? Now that we use a grammar
>>> and parser for WM can is it possible to expand
>>> expressions?
>>> Thanks
>>>
>>> --- "Eric B. Ridge" <eb...@tc...> wrote:
>>>
>>>
>>>
>>>> Rather than creating a StringMacro, create a
>>>> StringTemplate, with a mini-template of:
>>>> #set $foo = $x + 1
>>>>
>>>> Then use a custom TemplateVisitor to pull out the
>>>> "SetValue" argument of the #set directive:
>>>>
>>>> static class MyTemplateVisitor extends
>>>> TemplateVisitor {
>>>> Object value;
>>>>
>>>> public Object getValue() {
>>>> return value;
>>>> }
>>>>
>>>> public void visitDirectiveArg(String
>>>> string, Object object) {
>>>> // the #set directive has 2 arguments: "SetTarget" (LHS)
>>>> // and "SetValue" (RHS). We're only
>>>> interested in "SetValue"
>>>> if (string.equals("SetValue")) {
>>>> value = object;
>>>> }
>>>> }
>>>> }
>>>>
>>>> So, you're code will be something like:
>>>>
>>>> public Object evalExpression (Context context,
>>>> String expression) {
>>>> StringTemplate tmpl = new StringTemplate
>>>> (context.getBroker(), "#set $foo = " + expression);
>>>> MyTemplateVisitor visitor = new
>>>> MyTemplateVisitor();
>>>>
>>>> template.parse();
>>>> template.accept(visitor);
>>>>
>>>> Object value = visitor.getValue();
>>>> if (value instanceof Maco) {
>>>> return ((Macro) value).evaluate(_context);
>>>> } else {
>>>> return value;
>>>> }
>>>> }
>>>>
>>>> Hope this helps.
>>>>
>>>> eric
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
>>>>
>>>>
>>>>
>>>>> 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 <ke...@xa...> 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.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>
>>> === message truncated ===
>>>
>>>
>>
>>
>>
>
>
|
|
From: Sven S. <sv...@sc...> - 2005-09-26 14:02:28
|
Arghs. This is definitely not my day. The original mail was right. Just ignore... :/ >> Works perfect. At least as long as I deactivate caching. > > > s/deactivate/activate/ > > sorry |
|
From: Sven S. <sv...@sc...> - 2005-09-26 13:54:18
|
> Works perfect. At least as long as I deactivate caching. s/deactivate/activate/ sorry |
|
From: Sven S. <sv...@sc...> - 2005-09-26 13:50:14
|
Hi,
I just finished my custom template loader for webmacro. Goal of it is
context-based template loading and internationalization . It takes a
template name ("index" for example), determines the directory where the
appropriate version resides and adds an internationalization suffix.
example:
Template "index" in the context of the site "testSite" for language "en"
results in "testSite/index_en.wm" to be loaded.
Works perfect. At least as long as I deactivate caching.
Cause unfortunately the CacheManager/Provider/whatever does not get
notice of that the template name changed. So it returns the en-version
when the de-version should be loaded and so on...
Is there a way to let the CacheManager/Provider/whatever know about the
changed template name?
I also tried to work around this and not determine the resulting name
_inside_ the loader but call the loader with the already computed name.
This works as intended but leaves include-directives untouched.
Thanks in advance for your help!
Sven
|
|
From: Lane S. <la...@op...> - 2005-09-25 14:50:49
|
<html><body><font style=3D"font-family: arial,helvetica,sans-serif;" size=
=3D"2"><br> <br>I think it would be better to actually make the code availa=
ble <br>somewhere rather than hide it away on Wiki. Also, there's a few =
<br>things that should be done to that little function. Namely, caching =
<br>of StringTemplates. <br> <br>> Also, how do you use the Visitor to=
get a random value in the context? <br> <br>You don't. It's a TemplateVis=
itor, not a ContextVisitor. <br>
<br>
Eric: I will do this but I am not familiar with the TemplateVisitor usage. =
Is there an existing test case I can look at?<br>
<br>
-Lane<br> <br>eric <br> <br>> <br>> -Lane <br>> <br>> <br>> =
--- "Eric B. Ridge" <eb...@tc...> wrote: <br>> <br>> From: "Er=
ic B. Ridge" <eb...@tc...> <br>> Date: Thu, 22 Sep 2005 17:35:02 =
-0400 <br>> To: web...@li... <br>> Subject: Re=
: [WebMacro-user] Expression Handling Again <br>> <br>> On Sep 22, 20=
05, at 5:27 PM, Keats Kirsch wrote: <br>> <br>> > Eric's method is=
nice. <br>> <br>> It's also really fast. On the order of 20% faster =
than communicating <br>> the value through the Context. Which is importa=
nt if you're doing <br>> this sort of thing over and over in web-request=
s. <br>> <br>> eric <br>> <br>> > I do something similar (th=
ough less elegant) in the <br>> > PropertiesDirective. However for XM=
L files there is a much simpler <br>> > method that I sometimes use: =
just parse the XML file as a template <br>> > before you parse the XM=
L. Works great. <br>> > <br>> > You can use doubles in WMScript=
, but not natively with the built-in <br>> > operators. You can use t=
he $Math tool and the casting functions, <br>> > like $toDouble. <br>=
> > <br>> > Keats <br>> > <br>> > Dan Miller wrote:=
<br>> > <br>> > <br>> >> That method works great to g=
et the result. One last <br>> >> thing, how come webmacro expressi=
ons do not return <br>> >> double. Is that historical? Now that we=
use a grammar <br>> >> and parser for WM can is it possible to ex=
pand <br>> >> expressions? <br>> >> Thanks <br>> >&=
gt; <br>> >> --- "Eric B. Ridge" <eb...@tc...> wrote: <br>&=
gt; >> <br>> >> <br>> >> <br>> >>> Rath=
er than creating a StringMacro, create a <br>> >>> StringTempla=
te, with a mini-template of: <br>> >>> #set $foo =3D $x + 1 <br=
>> >>> <br>> >>> Then use a custom TemplateVisitor =
to pull out the <br>> >>> "SetValue" argument of the #set direc=
tive: <br>> >>> <br>> >>> static class MyTemplateVi=
sitor extends <br>> >>> TemplateVisitor { <br>> >>>=
Object value; <br>> >>> <br>> >>> public Object ge=
tValue() { <br>> >>> return value; <br>> >>> } <br>=
> >>> <br>> >>> public void visitDirectiveArg(Strin=
g <br>> >>> string, Object object) { <br>> >>> // t=
he #set directive has 2 arguments: "SetTarget" (LHS) <br>> >>> =
// and "SetValue" (RHS). We're only <br>> >>> interested in "Se=
tValue" <br>> >>> if (string.equals("SetValue")) { <br>> >=
;>> value =3D object; <br>> >>> } <br>> >>> }=
<br>> >>> } <br>> >>> <br>> >>> So, yo=
u're code will be something like: <br>> >>> <br>> >>&g=
t; public Object evalExpression (Context context, <br>> >>> Str=
ing expression) { <br>> >>> StringTemplate tmpl =3D new StringT=
emplate <br>> >>> (context.getBroker(), "#set $foo =3D " + expr=
ession); <br>> >>> MyTemplateVisitor visitor =3D new <br>> &=
gt;>> MyTemplateVisitor(); <br>> >>> <br>> >>>=
; template.parse(); <br>> >>> template.accept(visitor); <br>>=
; >>> <br>> >>> Object value =3D visitor.getValue(); <=
br>> >>> if (value instanceof Maco) { <br>> >>> ret=
urn ((Macro) value).evaluate(_context); <br>> >>> } else { <br>=
> >>> return value; <br>> >>> } <br>> >>&g=
t; } <br>> >>> <br>> >>> Hope this helps. <br>> =
>>> <br>> >>> eric <br>> >>> <br>> >=
>> <br>> >>> <br>> >>> <br>> >>> =
<br>> >>> On Sep 22, 2005, at 12:22 PM, Dan Miller wrote: <br>&=
gt; >>> <br>> >>> <br>> >>> <br>> >&=
gt;>> I guess what I was wondering about was using the <br>> >&=
gt;>> <br>> >>>> <br>> >>> api <br>> &g=
t;>> <br>> >>> <br>> >>>> directly steppin=
g in before the #set places the <br>> >>>> <br>> >>=
>> <br>> >>> result <br>> >>> <br>> >&g=
t;> <br>> >>>> into the context. I was looking into the s=
rc for <br>> >>>> PropertyMethod and trying to figure out ho=
w to get <br>> >>>> <br>> >>>> <br>> >&=
gt;> the <br>> >>> <br>> >>> <br>> >>&g=
t;> result. <br>> >>>> <br>> >>>> I am usi=
ng webmacro throughout a webproject, and <br>> >>>> <br>>=
>>>> <br>> >>> would <br>> >>> <br>>=
; >>> <br>> >>>> like to use similiar webmacro expr=
ession in xml <br>> >>>> <br>> >>>> <br>> =
>>> files <br>> >>> <br>> >>> <br>> >=
;>>> which are read and processed. Thanks <br>> >>>>=
; <br>> >>>> --- Keats Kirsch <ke...@xa...> wrote=
: <br>> >>>> <br>> >>>> <br>> >>>=
> <br>> >>>> <br>> >>>>> AFAIK there ar=
e only two ways to get something <br>> >>>>> <br>> >=
;>>>> <br>> >>> out <br>> >>> <br>> =
>>> <br>> >>>>> of a WM template <br>> >&g=
t;>>> expansion -- capture the result of the expansion, <br>> &=
gt;>>>> <br>> >>>>> <br>> >>> or =
<br>> >>> <br>> >>> <br>> >>>>> p=
ull something from <br>> >>>>> the context. Actually I su=
ppose you could use <br>> >>>>> <br>> >>>>=
> <br>> >>> the <br>> >>> <br>> >>> =
<br>> >>>>> #bean directive to <br>> >>>>&=
gt; create a "global" variable and then get it from <br>> >>>&g=
t;> <br>> >>>>> <br>> >>> the <br>> >=
;>> <br>> >>> <br>> >>>>> Broker. <br>&=
gt; >>>>> <br>> >>>>> Maybe if you can exp=
lain your requirements we <br>> >>>>> <br>> >>&g=
t;>> <br>> >>> could <br>> >>> <br>> >&=
gt;> <br>> >>>>> think of a way of <br>> >>&g=
t;>> doing what you want. <br>> >>>>> <br>> >=
>>>> Keats <br>> >>>>> <br>> >>>&=
gt;> Dan Miller wrote: <br>> >>>>> <br>> >>&g=
t;>> <br>> >>>>> <br>> >>>>> <br>=
> >>>>>> The usage of the StringMacro to use the #set =
<br>> >>>>>> <br>> >>>>>> <br>>=
; >>>>>> <br>> >>>>> directive <br>>=
>>>>> <br>> >>>>> <br>> >>>&g=
t;> <br>> >>>>>> works great. I was wondering if th=
ere is <br>> >>>>>> <br>> >>>>>> =
<br>> >>> anything <br>> >>> <br>> >>> =
<br>> >>>>>> exposed to evaluate the expression withou=
t <br>> >>>>>> <br>> >>>>>> <br>&=
gt; >>>>>> <br>> >>>>> modifying <br>&g=
t; >>>>> <br>> >>>>> <br>> >>>=
>> <br>> >>>>>> the context. <br>> >>&g=
t;>>> <br>> >>>>>> This works great, but I wo=
uld like to leave the <br>> >>>>>> context as is, not =
adding new temp variables to <br>> >>>>>> <br>> >=
;>>>>> <br>> >>> the <br>> >>> <br>&=
gt; >>> <br>> >>>>>> context. <br>> >&g=
t;>>>> <br>> >>>>>> Context ctx =3D new Co=
ntext(); <br>> >>>>>> ctx.put("val1", 1); <br>> >=
;>>>>> ctx.put("val2", 155); <br>> >>>>>&g=
t; Macro macro =3D null; <br>> >>>>>> macro =3D new St=
ringMacro("#set $val =3D $val1 + <br>> >>>>>> <br>>=
>>>>>> <br>> >>>>>> <br>> >&g=
t;>>> $val2"); <br>> >>>>> <br>> >>>=
>> <br>> >>>>> <br>> >>>>>> ma=
cro.evaluate( ctx); <br>> >>>>>> Integer val =3D (Inte=
ger)ctx.get("val"); <br>> >>>>>> <br>> >>>=
>>> <br>> >>>>>> I am looking forward to the =
2.0 release. <br>> >>>>>> <br>> >>>>>=
;> <br>> >>>>>> <br>> >>>>>> <=
br>> >>>>>> <br>> >>>>> <br>> >=
;>>>> <br>> >>>>> <br>> >>>>&g=
t; <br>> >> <br>> >> =3D=3D=3D message truncated =3D=3D=
=3D <br>> >> <br>> >> <br>> > <br>> > <br>>=
; > <br>> > <br>> > ----------------------------------------=
--------------- <br>> > SF.Net email is sponsored by: <br>> > T=
ame your development challenges with Apache's Geronimo App Server. <br>>=
> Download <br>> > it for free - -and be entered to win a 42" pla=
sma tv or your very <br>> own <br>> > Sony(tm)PSP. Click here to=
play: http://sourceforge.net/geronimo.php <br>> > __________________=
_____________________________ <br>> > Webmacro-user mailing list <br>=
> > Web...@li... <br>> > https://lists.s=
ourceforge.net/lists/listinfo/webmacro-user <br>> > <br>> <br>>=
<br>> <br>> ------------------------------------------------------- =
<br>> SF.Net email is sponsored by: <br>> Tame your development chall=
enges with Apache's Geronimo App Server. <br>> Download <br>> it fo=
r free - -and be entered to win a 42" plasma tv or your very own <br>> S=
ony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php <br>>=
; _______________________________________________ <br>> Webmacro-user ma=
iling list <br>> Web...@li... <br>> https://li=
sts.sourceforge.net/lists/listinfo/webmacro-user <br>> -----------------=
-------------------------------------- SF.Net <br>> email is sponsored=
by: Tame your development challenges with <br>> Apache's Geronimo App=
Server. Download it for free - -and be <br>> entered to win a 42" pla=
sma tv or your very own Sony(tm)PSP. Click <br>> here to play: http://=
sourceforge.net/geronimo.php <br>> ___________________________________=
____________ Webmacro-user <br>> mailing list Web...@li...=
ceforge.net https:// <br>> lists.sourceforge.net/lists/listinfo/webmacr=
o-user <br> <br> <br> <br>-------------------------------------------------=
------ <br>SF.Net email is sponsored by: <br>Tame your development challeng=
es with Apache's Geronimo App Server. Download <br>it for free - -and be en=
tered to win a 42" plasma tv or your very own <br>Sony(tm)PSP. Click here =
to play: http://sourceforge.net/geronimo.php <br>__________________________=
_____________________ <br>Webmacro-user mailing list <br>Webmacro-user@list=
s.sourceforge.net <br>https://lists.sourceforge.net/lists/listinfo/webmacro=
-user<br></font></body></html>
|
|
From: Lane S. <la...@op...> - 2005-09-25 14:47:47
|
<html><body><font style=3D"font-family: arial,helvetica,sans-serif;" size= =3D"2"><span style=3D"font-family: arial,helvetica,sans-serif;">Hi Eric,<br> <br> Thanks for the note.<br> <br> It would be good if someone in the WM community would check out WM and take over the updates to the application. The WM Wiki is really a terrific application. You did a lot of really nice things inside this app. The most recent updates I made make it possible to run a secure, invite-only Wiki. So, perhaps we can find someone motivated to carry the WM Wiki into mainline release 2.<br> <br> I will commit some minor style changes to the css and template file because= the right and left margins have zero margin.<br> <br> -Lane<br> <br> </span><br>--- "Eric B. Ridge" <eb...@tc...> wrote:<br><br>From: "Er= ic B. Ridge" <eb...@tc...><br>Date: Sun, 25 Sep 2005 00:59:30 -0400<= br>To: web...@li...<br>Subject: Re: [WebMacro-user] = wiki site<br><br>On Sep 24, 2005, at 12:00 PM, Lane Sharman wrote: <br> <br= >> Eric, <br>> <br>> Would you consider finding a delegate to help= make some updates to <br>> the wm wiki software? For example, the sty= le sheet needs to be <br>> updated (the margins are too tight). <br> <= br>This is the first complaint I've heard with the style/layout of the <b= r>site, but I'm pretty sure that we don't need to dedicate a person to <b= r>this. If you don't like the margins of the site, just commit a patch <= br>into CVS, let me know, and I'll update the website. <br> <br>This partic= ular issue is too subjective for me to "fix" to your liking. <br> <br>> = And, somene who wants to work with WM will find the Wiki software <br>>= ; an excellent proving ground for web presentation ideas (ajax, etc). <br= >> Or, do you want to do some work on it? <br> <br>I don't have the time= . However, CVS access is available. If you, or <br>anyone else out ther= e makes some nice enhancements I'll be happy to <br>get WebMacro's main w= ebsite updated. <br> <br>Along those lines, if there's a general interest i= n creating a new <br>website dedicated solely to WMWiki, I won't stand in= the way. <br> <br>eric <br> <br>> <br>> thanks, <br>> <br>> La= ne <br>> ------------------------------------------------------- SF.Net = <br>> email is sponsored by: Tame your development challenges with <= br>> Apache's Geronimo App Server. Download it for free - -and be <br>= > entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click <= br>> here to play: http://sourceforge.net/geronimo.php <br>> ______= _________________________________________ Webmacro-user <br>> mailing = list Web...@li... https:// <br>> lists.sourcefor= ge.net/lists/listinfo/webmacro-user <br> <br> <br> <br>--------------------= ----------------------------------- <br>SF.Net email is sponsored by: <br>T= ame your development challenges with Apache's Geronimo App Server. Download= <br>it for free - -and be entered to win a 42" plasma tv or your very own = <br>Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php <= br>_______________________________________________ <br>Webmacro-user mailin= g list <br>Web...@li... <br>https://lists.sourceforg= e.net/lists/listinfo/webmacro-user<br></font></body></html> |
|
From: Eric B. R. <eb...@tc...> - 2005-09-25 04:59:22
|
On Sep 24, 2005, at 12:00 PM, Lane Sharman wrote: > Eric, > > Would you consider finding a delegate to help make some updates to > the wm wiki software? For example, the style sheet needs to be > updated (the margins are too tight). This is the first complaint I've heard with the style/layout of the site, but I'm pretty sure that we don't need to dedicate a person to this. If you don't like the margins of the site, just commit a patch into CVS, let me know, and I'll update the website. This particular issue is too subjective for me to "fix" to your liking. > And, somene who wants to work with WM will find the Wiki software > an excellent proving ground for web presentation ideas (ajax, etc). > Or, do you want to do some work on it? I don't have the time. However, CVS access is available. If you, or anyone else out there makes some nice enhancements I'll be happy to get WebMacro's main website updated. Along those lines, if there's a general interest in creating a new website dedicated solely to WMWiki, I won't stand in the way. eric > > thanks, > > Lane > ------------------------------------------------------- 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 Web...@li... https:// > lists.sourceforge.net/lists/listinfo/webmacro-user |
|
From: Eric B. R. <eb...@tc...> - 2005-09-25 04:54:20
|
On Sep 23, 2005, at 12:45 PM, Lane Sharman wrote:
> ebr:
>
> this is cool. could you cut and paste this into a wiki page:
>
> AccessingContextValues
You should tie it into WMEval.java. Maybe like:
public Object evalExpr(Context ctx, String expression) throws
PropertyException;
I think it would be better to actually make the code available
somewhere rather than hide it away on Wiki. Also, there's a few
things that should be done to that little function. Namely, caching
of StringTemplates.
> Also, how do you use the Visitor to get a random value in the context?
You don't. It's a TemplateVisitor, not a ContextVisitor.
eric
>
> -Lane
>
>
> --- "Eric B. Ridge" <eb...@tc...> wrote:
>
> From: "Eric B. Ridge" <eb...@tc...>
> Date: Thu, 22 Sep 2005 17:35:02 -0400
> To: web...@li...
> Subject: Re: [WebMacro-user] Expression Handling Again
>
> On Sep 22, 2005, at 5:27 PM, Keats Kirsch wrote:
>
> > Eric's method is nice.
>
> It's also really fast. On the order of 20% faster than communicating
> the value through the Context. Which is important if you're doing
> this sort of thing over and over in web-requests.
>
> eric
>
> > I do something similar (though less elegant) in the
> > PropertiesDirective. However for XML files there is a much simpler
> > method that I sometimes use: just parse the XML file as a template
> > before you parse the XML. Works great.
> >
> > You can use doubles in WMScript, but not natively with the built-in
> > operators. You can use the $Math tool and the casting functions,
> > like $toDouble.
> >
> > Keats
> >
> > Dan Miller wrote:
> >
> >
> >> That method works great to get the result. One last
> >> thing, how come webmacro expressions do not return
> >> double. Is that historical? Now that we use a grammar
> >> and parser for WM can is it possible to expand
> >> expressions?
> >> Thanks
> >>
> >> --- "Eric B. Ridge" <eb...@tc...> wrote:
> >>
> >>
> >>
> >>> Rather than creating a StringMacro, create a
> >>> StringTemplate, with a mini-template of:
> >>> #set $foo = $x + 1
> >>>
> >>> Then use a custom TemplateVisitor to pull out the
> >>> "SetValue" argument of the #set directive:
> >>>
> >>> static class MyTemplateVisitor extends
> >>> TemplateVisitor {
> >>> Object value;
> >>>
> >>> public Object getValue() {
> >>> return value;
> >>> }
> >>>
> >>> public void visitDirectiveArg(String
> >>> string, Object object) {
> >>> // the #set directive has 2 arguments: "SetTarget" (LHS)
> >>> // and "SetValue" (RHS). We're only
> >>> interested in "SetValue"
> >>> if (string.equals("SetValue")) {
> >>> value = object;
> >>> }
> >>> }
> >>> }
> >>>
> >>> So, you're code will be something like:
> >>>
> >>> public Object evalExpression (Context context,
> >>> String expression) {
> >>> StringTemplate tmpl = new StringTemplate
> >>> (context.getBroker(), "#set $foo = " + expression);
> >>> MyTemplateVisitor visitor = new
> >>> MyTemplateVisitor();
> >>>
> >>> template.parse();
> >>> template.accept(visitor);
> >>>
> >>> Object value = visitor.getValue();
> >>> if (value instanceof Maco) {
> >>> return ((Macro) value).evaluate(_context);
> >>> } else {
> >>> return value;
> >>> }
> >>> }
> >>>
> >>> Hope this helps.
> >>>
> >>> eric
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
> >>>
> >>>
> >>>
> >>>> 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 <ke...@xa...> 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.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>
> >> === message truncated ===
> >>
> >>
> >
> >
> >
> >
> > -------------------------------------------------------
> > 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
> > Web...@li...
> > https://lists.sourceforge.net/lists/listinfo/webmacro-user
> >
>
>
>
> -------------------------------------------------------
> 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
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
> ------------------------------------------------------- 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 Web...@li... https://
> lists.sourceforge.net/lists/listinfo/webmacro-user
|
|
From: Lane S. <la...@op...> - 2005-09-24 16:17:50
|
<html><body><span style="font-family: arial,helvetica,sans-serif;"><font size="2">I am preparing a list of release 2 supported directives, and the deprecated ones.<br> <br> Keats, would you please look thru the list in the source tree and update cvs/wiki with your new property directive. For example, we have AttributeDirective, ParamDirective, and ConstDirective all are special cases of the #set directive. Do we need all of these? (I can see the value of the ConstDirective).<br> <br> Anyway, Keats, I would appreciate your review of the directives and the inclusion of your latest directive which I want to see included.<br> <br> http://www.webmacro.org/AllDirectives is the page I want to be solid for release 2 development,<br> <br> -Lane<br> </font></span></body></html> |
|
From: Lane S. <la...@op...> - 2005-09-24 16:00:13
|
<html><body><span style="font-family: arial,helvetica,sans-serif;">Eric,<br> <br> Would you consider finding a delegate to help make some updates to the wm wiki software? For example, the style sheet needs to be updated (the margins are too tight). And, somene who wants to work with WM will find the Wiki software an excellent proving ground for web presentation ideas (ajax, etc). Or, do you want to do some work on it?<br> <br> thanks,<br> <br> Lane<br> </span></body></html> |
|
From: Lane S. <la...@op...> - 2005-09-23 16:45:40
|
<html><body><font style=3D"font-family: arial,helvetica,sans-serif;" size=
=3D"2"><span style=3D"font-family: arial,helvetica,sans-serif;">ebr:<br>
<br>
this is cool. could you cut and paste this into a wiki page:<br>
<br>
AccessingContextValues<br>
<br>
Also, how do you use the Visitor to get a random value in the context?<br>
<br>
-Lane<br>
<br>
</span><br>--- "Eric B. Ridge" <eb...@tc...> wrote:<br><br>From: "Er=
ic B. Ridge" <eb...@tc...><br>Date: Thu, 22 Sep 2005 17:35:02 -0400<=
br>To: web...@li...<br>Subject: Re: [WebMacro-user] =
Expression Handling Again<br><br>On Sep 22, 2005, at 5:27 PM, Keats Kirsch =
wrote: <br> <br>> Eric's method is nice. <br> <br>It's also really fast.=
On the order of 20% faster than communicating <br>the value through the=
Context. Which is important if you're doing <br>this sort of thing over=
and over in web-requests. <br> <br>eric <br> <br>> I do something simil=
ar (though less elegant) in the <br>> PropertiesDirective. However fo=
r XML files there is a much simpler <br>> method that I sometimes use:=
just parse the XML file as a template <br>> before you parse the XML.=
Works great. <br>> <br>> You can use doubles in WMScript, but not n=
atively with the built-in <br>> operators. You can use the $Math tool=
and the casting functions, <br>> like $toDouble. <br>> <br>> Ke=
ats <br>> <br>> Dan Miller wrote: <br>> <br>> <br>>> That=
method works great to get the result. One last <br>>> thing, how com=
e webmacro expressions do not return <br>>> double. Is that historica=
l? Now that we use a grammar <br>>> and parser for WM can is it possi=
ble to expand <br>>> expressions? <br>>> Thanks <br>>> <b=
r>>> --- "Eric B. Ridge" <eb...@tc...> wrote: <br>>> <br=
>>> <br>>> <br>>>> Rather than creating a StringMacro,=
create a <br>>>> StringTemplate, with a mini-template of: <br>&g=
t;>> #set $foo =3D $x + 1 <br>>>> <br>>>> Then =
use a custom TemplateVisitor to pull out the <br>>>> "SetValue" ar=
gument of the #set directive: <br>>>> <br>>>> static=
class MyTemplateVisitor extends <br>>>> TemplateVisitor { <br>>=
;>> Object value; <br>>>> <br>>>> p=
ublic Object getValue() { <br>>>> return value; <br>&g=
t;>> } <br>>>> <br>>>> public void =
visitDirectiveArg(String <br>>>> string, Object object) { <br>>=
>> // the #set directive has 2 arguments: "SetTarget" (LH=
S) <br>>>> // and "SetValue" (RHS). We're only <br>&g=
t;>> interested in "SetValue" <br>>>> if (strin=
g.equals("SetValue")) { <br>>>> value =3D object; =
<br>>>> } <br>>>> } <br>>>> =
} <br>>>> <br>>>> So, you're code will be something l=
ike: <br>>>> <br>>>> public Object evalExpression (Contex=
t context, <br>>>> String expression) { <br>>>> Strin=
gTemplate tmpl =3D new StringTemplate <br>>>> (context.getBroker(=
), "#set $foo =3D " + expression); <br>>>> MyTemplateVisitor =
visitor =3D new <br>>>> MyTemplateVisitor(); <br>>>> <br>=
>>> template.parse(); <br>>>> template.accept(vis=
itor); <br>>>> <br>>>> Object value =3D visitor.getVa=
lue(); <br>>>> if (value instanceof Maco) { <br>>>> =
return ((Macro) value).evaluate(_context); <br>>>> } el=
se { <br>>>> return value; <br>>>> } <br>>=
>> } <br>>>> <br>>>> Hope this helps. <br>>>&=
gt; <br>>>> eric <br>>>> <br>>>> <br>>>>=
; <br>>>> <br>>>> <br>>>> On Sep 22, 2005, at 12=
:22 PM, Dan Miller wrote: <br>>>> <br>>>> <br>>>>=
; <br>>>>> I guess what I was wondering about was using the <br=
>>>>> <br>>>>> <br>>>> api <br>>>>=
; <br>>>> <br>>>>> directly stepping in before the #se=
t places the <br>>>>> <br>>>>> <br>>>> res=
ult <br>>>> <br>>>> <br>>>>> into the context=
. I was looking into the src for <br>>>>> PropertyMethod and tr=
ying to figure out how to get <br>>>>> <br>>>>> <br=
>>>> the <br>>>> <br>>>> <br>>>>> re=
sult. <br>>>>> <br>>>>> I am using webmacro through=
out a webproject, and <br>>>>> <br>>>>> <br>>>=
;> would <br>>>> <br>>>> <br>>>>> like to =
use similiar webmacro expression in xml <br>>>>> <br>>>&g=
t;> <br>>>> files <br>>>> <br>>>> <br>>>=
;>> which are read and processed. Thanks <br>>>>> <br>>=
;>>> --- Keats Kirsch <ke...@xa...> wrote: <br>>>=
>> <br>>>>> <br>>>>> <br>>>>> <br=
>>>>>> AFAIK there are only two ways to get something <br>&g=
t;>>>> <br>>>>>> <br>>>> out <br>>&g=
t;> <br>>>> <br>>>>>> of a WM template <br>>&=
gt;>>> expansion -- capture the result of the expansion, <br>>&=
gt;>>> <br>>>>>> <br>>>> or <br>>>&g=
t; <br>>>> <br>>>>>> pull something from <br>>&g=
t;>>> the context. Actually I suppose you could use <br>>>&=
gt;>> <br>>>>>> <br>>>> the <br>>>> =
<br>>>> <br>>>>>> #bean directive to <br>>>&g=
t;>> create a "global" variable and then get it from <br>>>>=
>> <br>>>>>> <br>>>> the <br>>>> <br=
>>>> <br>>>>>> Broker. <br>>>>>> <br=
>>>>>> Maybe if you can explain your requirements we <br>>=
;>>>> <br>>>>>> <br>>>> could <br>>&=
gt;> <br>>>> <br>>>>>> think of a way of <br>>=
;>>>> doing what you want. <br>>>>>> <br>>>=
;>>> Keats <br>>>>>> <br>>>>>> Dan M=
iller wrote: <br>>>>>> <br>>>>>> <br>>>=
>>> <br>>>>>> <br>>>>>>> The usag=
e of the StringMacro to use the #set <br>>>>>>> <br>>&=
gt;>>>> <br>>>>>>> <br>>>>>> d=
irective <br>>>>>> <br>>>>>> <br>>>>=
>> <br>>>>>>> works great. I was wondering if there=
is <br>>>>>>> <br>>>>>>> <br>>>&=
gt; anything <br>>>> <br>>>> <br>>>>>>>=
exposed to evaluate the expression without <br>>>>>>> <b=
r>>>>>>> <br>>>>>>> <br>>>>>=
;> modifying <br>>>>>> <br>>>>>> <br>>&=
gt;>>> <br>>>>>>> the context. <br>>>>&=
gt;>> <br>>>>>>> This works great, but I would like=
to leave the <br>>>>>>> context as is, not adding new te=
mp variables to <br>>>>>>> <br>>>>>>> <=
br>>>> the <br>>>> <br>>>> <br>>>>>&=
gt;> context. <br>>>>>>> <br>>>>>>> =
Context ctx =3D new Context(); <br>>>>>>> ctx.put("val1",=
1); <br>>>>>>> ctx.put("val2", 155); <br>>>>>=
;>> Macro macro =3D null; <br>>>>>>> macro =3D new =
StringMacro("#set $val =3D $val1 + <br>>>>>>> <br>>>=
;>>>> <br>>>>>>> <br>>>>>> $va=
l2"); <br>>>>>> <br>>>>>> <br>>>>>=
;> <br>>>>>>> macro.evaluate( ctx); <br>>>>&g=
t;>> Integer val =3D (Integer)ctx.get("val"); <br>>>>>>=
;> <br>>>>>>> <br>>>>>>> I am lookin=
g forward to the 2.0 release. <br>>>>>>> <br>>>>=
>>> <br>>>>>>> <br>>>>>>> <br>=
>>>>>> <br>>>>>> <br>>>>>> =
<br>>>>>> <br>>>>>> <br>>> <br>>>=
=3D=3D=3D message truncated =3D=3D=3D <br>>> <br>>> <br>> <=
br>> <br>> <br>> <br>> ----------------------------------------=
--------------- <br>> SF.Net email is sponsored by: <br>> Tame your d=
evelopment challenges with Apache's Geronimo App Server. <br>> Downloa=
d <br>> it for free - -and be entered to win a 42" plasma tv or your ver=
y own <br>> Sony(tm)PSP. Click here to play: http://sourceforge.net/ger=
onimo.php <br>> _______________________________________________ <br>>=
Webmacro-user mailing list <br>> Web...@li... <b=
r>> https://lists.sourceforge.net/lists/listinfo/webmacro-user <br>> =
<br> <br> <br> <br>------------------------------------------------------- =
<br>SF.Net email is sponsored by: <br>Tame your development challenges with=
Apache's Geronimo App Server. Download <br>it for free - -and be entered t=
o win a 42" plasma tv or your very own <br>Sony(tm)PSP. Click here to play=
: http://sourceforge.net/geronimo.php <br>_________________________________=
______________ <br>Webmacro-user mailing list <br>Web...@li...=
eforge.net <br>https://lists.sourceforge.net/lists/listinfo/webmacro-user<b=
r></font></body></html>
|
|
From: Eric B. R. <eb...@tc...> - 2005-09-22 21:35:44
|
On Sep 22, 2005, at 5:27 PM, Keats Kirsch wrote:
> Eric's method is nice.
It's also really fast. On the order of 20% faster than communicating
the value through the Context. Which is important if you're doing
this sort of thing over and over in web-requests.
eric
> I do something similar (though less elegant) in the
> PropertiesDirective. However for XML files there is a much simpler
> method that I sometimes use: just parse the XML file as a template
> before you parse the XML. Works great.
>
> You can use doubles in WMScript, but not natively with the built-in
> operators. You can use the $Math tool and the casting functions,
> like $toDouble.
>
> Keats
>
> Dan Miller wrote:
>
>
>> That method works great to get the result. One last
>> thing, how come webmacro expressions do not return
>> double. Is that historical? Now that we use a grammar
>> and parser for WM can is it possible to expand
>> expressions?
>> Thanks
>>
>> --- "Eric B. Ridge" <eb...@tc...> wrote:
>>
>>
>>
>>> Rather than creating a StringMacro, create a
>>> StringTemplate, with a mini-template of:
>>> #set $foo = $x + 1
>>>
>>> Then use a custom TemplateVisitor to pull out the
>>> "SetValue" argument of the #set directive:
>>>
>>> static class MyTemplateVisitor extends
>>> TemplateVisitor {
>>> Object value;
>>>
>>> public Object getValue() {
>>> return value;
>>> }
>>>
>>> public void visitDirectiveArg(String
>>> string, Object object) {
>>> // the #set directive has 2 arguments: "SetTarget" (LHS)
>>> // and "SetValue" (RHS). We're only
>>> interested in "SetValue"
>>> if (string.equals("SetValue")) {
>>> value = object;
>>> }
>>> }
>>> }
>>>
>>> So, you're code will be something like:
>>>
>>> public Object evalExpression (Context context,
>>> String expression) {
>>> StringTemplate tmpl = new StringTemplate
>>> (context.getBroker(), "#set $foo = " + expression);
>>> MyTemplateVisitor visitor = new
>>> MyTemplateVisitor();
>>>
>>> template.parse();
>>> template.accept(visitor);
>>>
>>> Object value = visitor.getValue();
>>> if (value instanceof Maco) {
>>> return ((Macro) value).evaluate(_context);
>>> } else {
>>> return value;
>>> }
>>> }
>>>
>>> Hope this helps.
>>>
>>> eric
>>>
>>>
>>>
>>>
>>>
>>> On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
>>>
>>>
>>>
>>>> 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 <ke...@xa...> 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.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>
>> === message truncated ===
>>
>>
>
>
>
>
> -------------------------------------------------------
> 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
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
|
|
From: Keats K. <ke...@xa...> - 2005-09-22 21:28:03
|
Eric's method is nice. I do something similar (though less elegant) in
the PropertiesDirective. However for XML files there is a much simpler
method that I sometimes use: just parse the XML file as a template
before you parse the XML. Works great.
You can use doubles in WMScript, but not natively with the built-in
operators. You can use the $Math tool and the casting functions, like
$toDouble.
Keats
Dan Miller wrote:
>That method works great to get the result. One last
>thing, how come webmacro expressions do not return
>double. Is that historical? Now that we use a grammar
>and parser for WM can is it possible to expand
>expressions?
>
>Thanks
>
>--- "Eric B. Ridge" <eb...@tc...> wrote:
>
>
>
>>Rather than creating a StringMacro, create a
>>StringTemplate, with a
>>mini-template of:
>> #set $foo = $x + 1
>>
>>Then use a custom TemplateVisitor to pull out the
>>"SetValue" argument
>>of the #set directive:
>>
>> static class MyTemplateVisitor extends
>>TemplateVisitor {
>> Object value;
>>
>> public Object getValue() {
>> return value;
>> }
>>
>> public void visitDirectiveArg(String
>>string, Object object) {
>> // the #set directive has 2 arguments:
>>"SetTarget" (LHS)
>> // and "SetValue" (RHS). We're only
>>interested in
>>"SetValue"
>> if (string.equals("SetValue")) {
>> value = object;
>> }
>> }
>> }
>>
>>So, you're code will be something like:
>>
>>public Object evalExpression (Context context,
>>String expression) {
>> StringTemplate tmpl = new StringTemplate
>>(context.getBroker(),
>>"#set $foo = " + expression);
>> MyTemplateVisitor visitor = new
>>MyTemplateVisitor();
>>
>> template.parse();
>> template.accept(visitor);
>>
>> Object value = visitor.getValue();
>> if (value instanceof Maco) {
>> return ((Macro) value).evaluate(_context);
>> } else {
>> return value;
>> }
>>}
>>
>>Hope this helps.
>>
>>eric
>>
>>
>>
>>
>>
>>On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
>>
>>
>>
>>>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 <ke...@xa...> 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.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>
>=== message truncated ===
>
>
|
|
From: Dan M. <psi...@ya...> - 2005-09-22 18:40:04
|
That method works great to get the result. One last
thing, how come webmacro expressions do not return
double. Is that historical? Now that we use a grammar
and parser for WM can is it possible to expand
expressions?
Thanks
--- "Eric B. Ridge" <eb...@tc...> wrote:
> Rather than creating a StringMacro, create a
> StringTemplate, with a
> mini-template of:
> #set $foo = $x + 1
>
> Then use a custom TemplateVisitor to pull out the
> "SetValue" argument
> of the #set directive:
>
> static class MyTemplateVisitor extends
> TemplateVisitor {
> Object value;
>
> public Object getValue() {
> return value;
> }
>
> public void visitDirectiveArg(String
> string, Object object) {
> // the #set directive has 2 arguments:
> "SetTarget" (LHS)
> // and "SetValue" (RHS). We're only
> interested in
> "SetValue"
> if (string.equals("SetValue")) {
> value = object;
> }
> }
> }
>
> So, you're code will be something like:
>
> public Object evalExpression (Context context,
> String expression) {
> StringTemplate tmpl = new StringTemplate
> (context.getBroker(),
> "#set $foo = " + expression);
> MyTemplateVisitor visitor = new
> MyTemplateVisitor();
>
> template.parse();
> template.accept(visitor);
>
> Object value = visitor.getValue();
> if (value instanceof Maco) {
> return ((Macro) value).evaluate(_context);
> } else {
> return value;
> }
> }
>
> Hope this helps.
>
> eric
>
>
>
>
>
> On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
>
> > 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 <ke...@xa...> 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
> >> Web...@li...
> >>
> >>
> >
>
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
> > _______________________________________________
> > Webmacro-user mailing list
> > Web...@li...
> >
>
https://lists.sourceforge.net/lists/listinfo/webmacro-user
> >
>
>
>
>
-------------------------------------------------------
> 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
> Web...@li...
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|
|
From: Eric B. R. <eb...@tc...> - 2005-09-22 16:31:19
|
Rather than creating a StringMacro, create a StringTemplate, with a
mini-template of:
#set $foo = $x + 1
Then use a custom TemplateVisitor to pull out the "SetValue" argument
of the #set directive:
static class MyTemplateVisitor extends TemplateVisitor {
Object value;
public Object getValue() {
return value;
}
public void visitDirectiveArg(String string, Object object) {
// the #set directive has 2 arguments: "SetTarget" (LHS)
// and "SetValue" (RHS). We're only interested in
"SetValue"
if (string.equals("SetValue")) {
value = object;
}
}
}
So, you're code will be something like:
public Object evalExpression (Context context, String expression) {
StringTemplate tmpl = new StringTemplate (context.getBroker(),
"#set $foo = " + expression);
MyTemplateVisitor visitor = new MyTemplateVisitor();
template.parse();
template.accept(visitor);
Object value = visitor.getValue();
if (value instanceof Maco) {
return ((Macro) value).evaluate(_context);
} else {
return value;
}
}
Hope this helps.
eric
On Sep 22, 2005, at 12:22 PM, Dan Miller wrote:
> 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 <ke...@xa...> 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
>> Web...@li...
>>
>>
> 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
> _______________________________________________
> Webmacro-user mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
|
|
From: Dan M. <psi...@ya...> - 2005-09-22 16:22:38
|
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 <ke...@xa...> 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
> Web...@li...
>
https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
|
|
From: Keats K. <ke...@xa...> - 2005-09-22 16:13:28
|
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.
>
>
|