velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Colebatch" <...@nuix.com.au>
Subject directives, alternative implementation
Date Fri, 01 Mar 2002 23:59:13 GMT
hey all,

firstly, this is my first usage of Velocity, so if there's an FAQ I should've read that answers
this - please point (o;  (I have
read most of the stuff I've been able to find).  Secondly, I think this is probably more a
dev question, but by rights, I should ask
here first, so I am (o:

ok... I'm trying to implement a javascript powered framework, allowing someone to write javascript
servlet/action style classes, and
use them in their pages on the server side.  Velocity seems to be a good choice for the pages
as javascript being a dynamicaly typed
interpreted language I need to be able to implement the glue between the pages and the javascript
classes at runtime, which Velocity
looks like it'll let me do.

What I want to do, is in my servlet, put a couple of Javascript objects (implementing the
Rhino Scriptable interface) int he
context.  Thing is, when I call

$myObject.foo()

in my template, I need that to call a method

jsFunction_foo()

on that object ... essentially every directive will need to change in some form for this to
work.  So I'm looking in the
org.apache.velocity.runtime.parser.node package at classes like ASTReference, which appear
to be responsible for handling all this.

So, onto my questions:

1. I've never used jjtree or Javacc before, and want to know how I should understand the way
the node package is created (from what
I gather it(/parts of it) is(/are) generated by this.

2. Has anyone else done this sort of thing, for Rhino, or anyhting else, that I might be able
to get a head start from?

3. The way I'm looking at things so far, is something like this.... for ASTIdentifier, I've
added the following lines of code to
doIntrospection() after the last try...

        if( executor.isAlive() == false)
        {
            executor = new ScriptablePropertyExecutor( rsvc, data, identifier );
        }

and then made the new ScriptablePropertyExecutor a subclass of PropertyExecutor and overridden
the discover method.  This seems to
be the right thing to do, but I think that I'm going to have to get all the pieces in the
puzzle before it'll work properly.

ok - so if anyone can offer any feedback, that would be great...  if not, I might try the
dev list.

cheers, and tia
dim




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


Mime
View raw message