commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [jelly] scripting
Date Tue, 01 Oct 2002 16:42:55 GMT
From: "Jason Horman" <jhorman@musicmatch.com>
> 1. If the BeanShell JellyInterpreter (and BSF) would pass the
"jellyContext"
> to the beanshell then scripts could update the context.
>
> diff -r1.5 JellyInterpreter.java
> 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)

http://www.webweavertech.com/ovidiu/weblog/archives/000059.html

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

<bsh:script>
    foo = new Whatever(12, abc);
    for (int i = 0; i < foo.size(); i++ ) {
        <sql:update>...</sql:update>
    }
</bsh:script>

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message