Menu

[r489]: / trunk / php-java-bridge / examples / php+jsp / sessionSharing.php  Maximize  Restore  History

Download this file

24 lines (19 with data), 491 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
require_once("java/Java.inc");
$session = java_session();
?>
<HTML>
<TITLE>PHP and JSP session sharing</title>
<BODY>
<?php
if(is_null($session->get("counter"))) {
$session->put("counter", new Java("java.lang.Integer", 1));
}
$counter = java_values($session->get("counter"));
print "HttpSession variable \"counter\": $counter<br>\n";
$next = new Java("java.lang.Integer", $counter+1);
$session->put("counter", $next);
?>
<a href="sessionSharing.jsp">JSP page</a>
</BODY>
</HTML>