Hi Amey,

question1)

I'm afraid that you can't do that without unloading the registered engines. 

The reason is native JavaScript evalution mechanism keeps track of all
the methods in a script in a script scope which it gets as an
argument. Since JavaScriptEngine used in BSF uses the same scope -
that contains all the declared beans ..etc - for each evaluation, a
function declared in a previously evaluated script is visible for any
other execution afterwards.

question2)

isnt that you've just done in the script2.

hope this will help

Cheers !!

-sanka


On 5/11/05, Amey Rokde <[EMAIL PROTECTED]> wrote:
> Hi
> We are using BSF 2.3.0 for providing scripting functionality into our 
> product.Basically we are using bsf framework to embedded java script inside 
> our
> product.We are facing a tricky scenario.Let me explain
> 
> Script 1 :
> 
>     add()
> 
> Script 2 :
>    function add()
>    {
> 
>    }
> 
>    function delete()
>    {
> 
>    }
> 
>    delete();
> 
> when we give a first call with script1, it crashes saying the add() is 
> undefined which is right,
> then second call with script2 delete() is called which is invoked properly 
> and then we make third call with script1,add() is invoked which should not be
> as script1 does not define it.
> Through out we are using the same instance of bsf manager.After calling 
> terminate method on bsf manager after each call, then this undesired behavior
> is stopped.
> Now as per i understand looking into code, by calling bsf manager terminate 
> we are unloading the registered engines and thus the context of javascript is 
> cleared.If this is right or above behavior is caused by this,then is it 
> possible to clear the context without unloading the registered engines.Mind 
> you this is same thread which is making all the three calls.



> 
> Second,this is not that critical but any ways would like to ask that is there 
> any way to call a particular function from the entire java script file.
> Any light on this matter will be greatly appreciated.
> Amey
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to