Menu

[r355]: / trunk / php-java-bridge / examples / java-server-faces / helloWorld.php  Maximize  Restore  History

Download this file

31 lines (25 with data), 699 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
class helloWorld {
var $name="myName";
function getValue($prop) {
return $this->$prop;
}
function setValue($prop, $val) {
$this->$prop = $val;
}
function send() {
return "success";
}
function xvalidate($ctx, $arg, $value) {
echo "validate: $value";
if($value->equals("myName")) {
echo "throw exception.";
$message = new Java("javax.faces.application.FacesMessage", "$value invalid, enter yourname");
throw
new JavaException("javax.faces.validator.ValidatorException", $message);
}
}
}
// call() returns true if the php file was called from java.
java_context()->call(java_closure(new helloWorld())) ||include("index.php");
?>