jakarta-bsf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daling Xu <daling...@yahoo.com>
Subject How to run multiple scriptlet files at the same time
Date Tue, 15 May 2007 22:02:23 GMT
Hi,
   
  I have asked this question before but couldn't get a working solution, let me try to rephrase
my scenario. It's really critical for my project.
   
  I am using BSF to call scriptling code from my java app. Because my business logic is complicated,
I would like to separate them into several script files, e.g. main.js, mylib.js.
   
  In mylib.js, I just define some functions that will be called from main.js
   
  In Rhino engine's shell, I can call the two files together by 
  Context.enter();
  Context context = Context.getCurrentContext();
  
  
  ScriptableObject scope1 = context.initStandardObjects();
  context.evaluateReader( scope1, new FileReader("C:\\scriptAgents\\sample2\\mylib.js"), 
  "mylib.js", 1, null); 
  context.evaluateReader( scope1, new FileReader("C:\\scriptAgents\\sample2\\main.js"), 
  "main.js", 1, null);
   
  I tested the code, it runs well.
  
But when I use BSF, my java code can ( and should ) only access BSF's api, which only have
one eval() method that takes one file and execute it, so I can't call the main and lib at
the same time, and my main.js will actually throw exception of "method not defined" exception.
   
  So is it purposely designed in BSF to execute scriptlet only one at a time? Is it still
posibble to enable this capability in BSF?? 
   
  Thanks
   
  Daling

       
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel. 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message