jakarta-bsf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver.Kowa...@freudenberg.de
Subject how to access scripted objects?
Date Fri, 31 Jan 2003 16:35:49 GMT
Hi,

I've no idea how to access scripted objects (JavaScript). My java test app
looks like this:

BSFManager mgr = new BSFManager();
BSFEngine engine = mgr.loadScriptingEngine("javascript");
FileReader in = new FileReader("c:/temp/test.js");
String script = IOUtils.getStringFromReader( in);
	
Object obj = engine.eval("", -1, -1, script);

The JavaScript test.js looks like this :

var g_test = new Array();
function f()
{
   g_test[1] = new Object();
   g_test[1].str = 'Y1Z1';
   g_test[2] = new Object();
   g_test[2].str = 'Y1Z2';
}

The variable 'g_test' will be initialized by function 'f()'.
I don't know how to invoke 'f()' and how to access 'g_test'.

Please help.
With kind regards,
Oliver

Freudenberg IT KG			mailto:oliver.kowalke@freudenberg.de
Produktentwicklung		http://www.freudenberg-it.de
Obergraben 10			Fon: +49 (0) 351 89 85 661
01097 Dresden, Germany		Fax: +49 (0) 351 89 85 666 


Mime
View raw message