commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [jelly] scripting
Date Tue, 01 Oct 2002 16:42:55 GMT
From: "Jason Horman" <>
> 1. If the BeanShell JellyInterpreter (and BSF) would pass the
> to the beanshell then scripts could update the context.
> diff -r1.5
> 95a96,97
> >
> >         set( "jellyContext" , context );

Applied. Great idea, thanks!

> 2. A "script" or "bsh" tag would be cool, something simple like this:
> public class BSHTag extends TagSupport {
>     private BeanShellExpressionFactory factory = new
> BeanShellExpressionFactory();
>     public void doTag(XMLOutput xmlOutput) throws Exception {
>         Expression exp = factory.createExpression(getBodyText(true));
>         exp.evaluate(context);
>     }
> }
> that would allow me to do this:
>     <bsh>
>         System.out.println("hi");
>     </bsh>

Another good idea. Been meaning to do this for a while. Its now applied and
in CVS. (Though as yet there's not much in the way of JellyUnit test cases).

One thing still left to do is to support a better BeanShell NameSpace
implementation, so that the ScriptTag could call Interpreter.eval(text,
jellyNameSpace) so that as beanshell defines variables, they can be
reflected back into the JellyContext and vice versa etc.

Also implementing a ScriptTag for the BSF library would be a good idea, so
we get the same behaviour in any scripting language which would rock.

Incidentally I rambled on recently on Ovidiu's blog about how we could
implement nested tags within a <script> tag (near the bottom of the page in
the comments section)

So we could mix scripting languages and tags to do do wierd and wonderful
things like..

    foo = new Whatever(12, abc);
    for (int i = 0; i < foo.size(); i++ ) {


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message