You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Mark R. Diggory" <md...@latte.harvard.edu> on 2003/02/04 16:40:57 UTC
[OT][Jelly] dealing with reserved terms 'this', 'super'
I posted this message to the BSF lists with "0" response. I 'm hoping
maybe someone who is using BSF in the Jelly taglibrary might be able to
shed some light on my issue, thanks.
I'm using BSF in a method of a class kinda like this:
public class Test{
protected BSFManager manager = null;
protected double value;
public Test()throws BSFException{
manager = new BSFManager();
manager.declareBean("this",this, this.getClass());
}
public Object myMethod(String script) throws BSFException{
BSFEngine engine = manager.loadScriptingEngine("javascript");
return engine.eval("my_generated_method",0, 0, script);
}
public void setValue(double value){
this.value = value;
}
public double getVlaue(){
return value;
}
}
this idea is that I could write script that looks very much like java
code that would normally go into "myMethod". However, it appears that
words like "this" and "super" are reserved words in BSF/Javascript. Is
there anyway I can
get "this" to "reference the object instance of this class in my scripts?
I.E. I want a javascript that looks something like this to run an object
instance of this class.
{
this.setValue(0.04322*100);
this.getValue();
}
Is there a means to define a reference to "this" as available in the BSF
ObjectRegistery?
Thanks
-Mark Diggory
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org