You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-user@jakarta.apache.org by Daling Xu <da...@yahoo.com> on 2007/04/16 17:54:30 UTC

How to call function in another .js file?

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.