PDA

View Full Version : pass java objects to script when using QuercusEngine


bigwheels16
03-14-2012, 06:38 AM
QuercusEngine engine = new QuercusEngine();
Value value = engine.execute("<?php return $obj->name; ?>");
System.out.println(value);

I have code like this and it appears to run, but the problem is I would like the $obj in the script to be an actual java object instance that is already created, but I can't figure out how to pass parameters to the script.

Something like this:
engine.setParam("obj", new Object());

How can I do this?

bigwheels16
03-15-2012, 01:19 AM
I figured out how to do this. See: http://stackoverflow.com/questions/9706430/how-to-inject-java-instances-into-php-scripts-programmatically-executed-using-qu/9712709#9712709