|
From: <php...@li...> - 2007-11-30 12:29:15
|
Hi,
> The bridge supports the JSR223 API. Which means that you could do the following (in pseudo
> code):
the following code works with the pure Java implementation (PHP/Java Bridge version 4):
<%
out.print("hello from JSP");
javax.script.ScriptEngineManager m = new javax.script.ScriptEngineManager ();
javax.script.ScriptEngine e = m.getEngineByName ("php");
javax.script.ScriptContext c = e.getContext ();
java.io.Writer w=new java.io.FilterWriter(out){public void close()throws
java.io.IOException{flush();}};
c.setWriter (w);
e.eval ("<?php echo java_inspect(java_context());?>");
e.eval ("<?php $w=java_context()->getWriter(); $w->write(\"hello from PHP\"); $w->close();?>");
e.eval ("<?php phpinfo(); ?>");
%>
Note the FilterWriter above. It is needed because some versions close the output stream at the end
of the script.
Regards,
Jost Boekemeier
__________________________________ Ihr erstes Baby? Holen Sie sich Tipps von anderen Eltern. www.yahoo.de/clever
|