Hi Rony,
   
  Thank you for you assistance.
   
  I modified my code for the approach using manager.registerBean() :
   
  BSFManager manager = new BSFManager();
  manager.registerBean( "myBeanName", new MyBeanClazz("str for regBean");
  manager.exec( "javascript", "test", 0,0, 
"bsf.lookupBean(\"myBeanName\").myMethod();" );
   
  This time it works and printed out the string in the console. Thanks.
   
  It looks that the BSFManager defaultly declared a bean "bsf" so the script 
can always use it just like a predefined object in the javascript.
   
  But for my ObjectRegistery approach, even I tried to call bsf.lookupBean in 
the script code, it still doesn't work, anything still missing here?
   
  Linda
   
  

"Rony G. Flatscher" <[EMAIL PROTECTED]> wrote:
  Hi Linda,

there is a difference between declaring and registering a bean:
declareBean() tries to inform the BSF engine explicitly about the bean,
such - if supported by the language - that it gets implicitly defined
for the script, whereas declared beans need to be looked up by the
script before being able to use it.

Or with other words: have the script look-up the bean before using it.
E.g., in Javascript:

myBean = bsf.lookupBean ("myBean"); /* retrieve a registered Java
object */

HTH,

---rony



 
---------------------------------
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.

Reply via email to