|
From: <php...@li...> - 2009-07-01 17:41:07
|
Hi,
I think you have failed to understand the JSP example.
HELLO_SCRIPT_READER is static final to make sure that the resource is
(re-)created with the jsp.class file; the PHP code passed to
createPhpScriptReader() is always compiled to a "/..._cache_.php file" with
the JSP file.
Everything else is a simple wrapper for
requestDispatcher.include("/..._cache_.php").
Please correct your code; remove the createPhpScriptReader() call and remove
the PhpScriptReader argument from the createPhpScriptFileReader(String,
PhpScriptReader) call, e.g. use: createPhpScriptFileReader("/index.php").
Then request your PHP "/index.php" resource from the browser. I that works,
then including the resource into a local JSP or Java resource or executing
it as a JSR223 script will work as well.
Regards,
Jost Boekemeier
1. Jul 2009 5:06 nachm. schrieb am <
php...@li...>:
HI
When I try to execute the php script with ScriptEngine from java I am not
getting any response. Its hangs over there. Please let me know what is the
problem. Here is my code.
try{
Reader HELLO_SCRIPT_READER =
EngineFactory.createPhpScriptReader("<?php echo 'Hello java world!'; ?>");
ScriptEngine scriptEngine =
EngineFactory.getPhpScriptEngine(context.getServlet(),context.getServlet().getServletContext(),
request, response);
java.io.Reader readerHello =
EngineFactory.createPhpScriptFileReader(request.getServletPath()+"._cache_.php",
HELLO_SCRIPT_READER);
PrintWriter out = new PrintWriter(new BufferedWriter(new
FileWriter("C:/foo.out")));
scriptEngine.getContext().setWriter (out);
scriptEngine.eval(readerHello);
readerHello.close();
} catch (Exception e){
System.out.println(e);
}
Thanks
- Ravi -
------------------------------------------------------------------------------
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|