WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: BSF + Jython: intercepting the access to the variables ?

How to call function in another .js file?

by Daling Xu :: Rate this Message:

| View in Thread

Hi,
   
  I am using BSF to execute a javascript file from my java application.
   
  Because my logic is complicate, I would like to separate them into functions and put functions into different .js files.
   
  I started to execute my main javascript file like:
   
  BSFManager bsfManager = new BSFManager();
  bsfManager.exec( "javascript",
  "" , 0, 0,
  IOUtils.getStringFromReader(new FileReader("main.js") ));
   
  From the main.js, how can I call a function myfunc1() which is declared in anotherFile.js?
   
  Thanks
   
  Linda

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

 « Return to Thread: BSF + Jython: intercepting the access to the variables ?