You are here: PHP combined with JAVA « PHP « IT news, forums, messages
PHP combined with JAVA

Posted by "Stasa Jerinic" on 09/15/05 13:21

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация