summaryrefslogtreecommitdiff
path: root/js/dojo/dojox/rpc/demos/demo_jabsorb.html
blob: 8452341d89fc246c45b500ac62637343a068d4a5 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
This file is a demo of the Dojo + jabsorb

You must have jabsorb installed in order for this to run.
This assumes that jabsorb is at /jabsorb-1.3/, but you
can change the target if it as a different location.

This uses the Hello example from the jabsorb framework (Hello.java and hello.jsp)
-->
<html>
<head>
	<title>Demo of Dojo + jabsorb</title>
	<style type="text/css">

		@import "../../../dijit/themes/tundra/tundra.css";
		@import "../../../dojo/resources/dojo.css";
	</style>

	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
	<script type="text/javascript">
		dojo.require("dojox.rpc.Service");
		dojo.require("dojox.rpc.JsonRPC");
		var services = new dojox.rpc.Service({
			target:"/jabsorb-1.3/JSON-RPC",
			transport:"POST",
			envelope:"JSON-RPC-1.0",
			contentType:"application/json",
			services:{
				"hello.sayHello":{
					returns:{"type":"string"},
					parameters:[{"type":"string"}]
				}
			}
		});
		function clickHello() {
			var whoInput = document.getElementById("who");
			var deferred = services["hello.sayHello"](whoInput.value);
			deferred.addCallback(function(result) {
				alert(result);
				return result;
			})
		}

	</script>
</head>

<body class="tundra">
	<h1>
		DEMO:  jabsorb
	</h1>
	<hr>
	<h3>
		Description:
	</h3>
	<p>
		This simple demo shows how to connect to a <a href="http://jabsorb.org/">jabsorb server</a>
	</p>
<p>The jabsorb <em>Hello World</em> application.</p>

<p>
  <strong>Who:</strong>
  <input type="text" id="who" size="30" value="Michael"/>
  &nbsp;

  <input type="button" value="Say Hello" onclick="clickHello()"/>
</p>
<body>
	<hr/>
</body>
</html>