From: Jost B. <jos...@ya...> - 2005-11-15 17:36:45
|
Victor, > Can setAttribute be used to save a java object in > application scope? $ctx->put($key, $val) can be used to store $val into the "application store", yes. Please see the documentation for details (php-java-bridge.sf.net). This private "application store" is not shared with .jsp or servlets. If you really need to access the servlet context in version 2.x, please use the following code: public class MyControllerServlet extends PhpJavaServlet { protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { req.getSession().setAttribute("ServletContext", getServletConfig().getServletContext()); } } After that please change all references to "PhpJavaServlet" to "MyControllerServlet" in the file WEB-INF/web.xml. You can access the servlet context as follows: <?php dl('java.so'); $servletCtx = java_session()->get("ServletContext"); ... $servletCtx->setAttribute(...) ?> > btw, where can I download 3.0? A preview version is in our CVS repository. But the code is neither stable nor complete (some classes to work with Java Server Faces are still missing). Regards, Jost Boekemeier ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de |