sebb wrote: > I'd like to be able to pass a variable into a BSF script, allow the > script to change the value of the variable, and retrieve the changed > value when the script has finished. > > I've tried: > > mgr.declareBean("Message", "OK", String.class); > BSFEngine bsfEngine = mgr.loadScriptingEngine("groovy"); > bsfOut=bsfEngine.eval("script", 0, 0, "Message=\"123\""); > > but > > mgr.lookupBean("Message"); > > returns the original value of the string, i.e. "OK" > > The script can set the value using > > bsf.registerBean("Message","123") > > but this is rather messy compared with being able to do: > > Message="123" > > It would be nice if there was a way to access the variables themselves. > > Is this possible in BSF? Well, this would be a feature of the BSF engine for your language (accessing, changing, storing Java objects in the BSF registry).
Depending on the scripting language at hand making BSF registry entries available transparently to your programming language as if they were variables defined in the context of your script code could be easy/simple (e.g. because it already supports Java bindings one way or the other) or complicated (has no clues of Java at all, hence the bridging/interfacing support needs to be created). HTH, ---rony --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]