|
From: <php...@li...> - 2009-06-08 10:25:37
|
Hi
I am trying to invoke a php function from the servlet. I am getting the following error. Pls find the following code.
public void doPost(
final HttpServletRequest httpRequest,
final HttpServletResponse httpResponse)
throws ServletException, IOException {
try {
URI remotePhpApp = new URI("http://localhost:9080/JavaBridge/java/JavaProxy.php");
ScriptEngine e =
EngineFactory.getInvocablePhpScriptEngine (this,
this.getServletContext(), httpRequest, httpResponse, remotePhpApp);
Object result = ((Invocable)e).invokeFunction("phpversion", new Object[]{});
System.out.println(result);
e.eval ((Reader)null);
} catch (Exception ex) {
System.out.println("Could not evaluate script: "+ex);
} finally { // make sure to close() the file
// in JDK 1.5 and above use ((Closeable)e).close() instead
}
}
I am getting following error.
Could not evaluate script: java.lang.IllegalStateException: No EngineFactory found. Have you registered a listener?
The same code works fine with jsp.
Thanks
- Ravi -
|