PHP combined with JAVA

From: Date: Thu, 15 Sep 2005 10:21:57 +0000
Subject: PHP combined with JAVA
Groups: php.general 
Request: Send a blank email to php-general+get-222473@lists.php.net to get a copy of this message
Hallo, I write one Java class that gives my name back. I implemented the call of this Java class in php Unit, but there are some problems, because I will to make only one time the instance of Java class and put it into Session and everytime when the page is reloaded to load the Java object from the session. By first time calling the php unit its work, but after reloading the unit (in the example below, after clicking the button Send) I get everytime java.lang.NullPointerException. The example: <?php session_start(); echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">"; if (!isset($_SESSION['P_User'])) { echo "Class not set<br>"; $t = new Java("User"); $_SESSION['P_User']= $t; } else { echo "Class set<br>"; } $t1= $_SESSION['P_User']; echo $t1->getUserName(); echo '<input type="submit" value="Send" name="B1">'; echo "</form>" ?> What I want to do, is to make only one time a instance of java class and to use this object during the session (Internet browser of client) is opened and not to create everytime the java instance by reloading or requesting other php Unit. Greetings, Jerinic Stasa

« previous php.general (#222473) next »