| 1 | <!-- |
|---|
| 2 | This file is a demo of the Dojo + jabsorb |
|---|
| 3 | |
|---|
| 4 | You must have jabsorb installed in order for this to run. |
|---|
| 5 | This assumes that jabsorb is at /jabsorb-1.3/, but you |
|---|
| 6 | can change the target if it as a different location. |
|---|
| 7 | |
|---|
| 8 | This uses the Hello example from the jabsorb framework (Hello.java and hello.jsp) |
|---|
| 9 | --> |
|---|
| 10 | <html> |
|---|
| 11 | <head> |
|---|
| 12 | <title>Demo of Dojo + jabsorb</title> |
|---|
| 13 | <style type="text/css"> |
|---|
| 14 | |
|---|
| 15 | @import "../../../dijit/themes/tundra/tundra.css"; |
|---|
| 16 | @import "../../../dojo/resources/dojo.css"; |
|---|
| 17 | </style> |
|---|
| 18 | |
|---|
| 19 | <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script> |
|---|
| 20 | <script type="text/javascript"> |
|---|
| 21 | dojo.require("dojox.rpc.Service"); |
|---|
| 22 | dojo.require("dojox.rpc.JsonRPC"); |
|---|
| 23 | var services = new dojox.rpc.Service({ |
|---|
| 24 | target:"/jabsorb-1.3/JSON-RPC", |
|---|
| 25 | transport:"POST", |
|---|
| 26 | envelope:"JSON-RPC-1.0", |
|---|
| 27 | contentType:"application/json", |
|---|
| 28 | services:{ |
|---|
| 29 | "hello.sayHello":{ |
|---|
| 30 | returns:{"type":"string"}, |
|---|
| 31 | parameters:[{"type":"string"}] |
|---|
| 32 | } |
|---|
| 33 | } |
|---|
| 34 | }); |
|---|
| 35 | function clickHello() { |
|---|
| 36 | var whoInput = document.getElementById("who"); |
|---|
| 37 | var deferred = services["hello.sayHello"](whoInput.value); |
|---|
| 38 | deferred.addCallback(function(result) { |
|---|
| 39 | alert(result); |
|---|
| 40 | return result; |
|---|
| 41 | }) |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | </script> |
|---|
| 45 | </head> |
|---|
| 46 | |
|---|
| 47 | <body class="tundra"> |
|---|
| 48 | <h1> |
|---|
| 49 | DEMO: jabsorb |
|---|
| 50 | </h1> |
|---|
| 51 | <hr> |
|---|
| 52 | <h3> |
|---|
| 53 | Description: |
|---|
| 54 | </h3> |
|---|
| 55 | <p> |
|---|
| 56 | This simple demo shows how to connect to a <a href="http://jabsorb.org/">jabsorb server</a> |
|---|
| 57 | </p> |
|---|
| 58 | <p>The jabsorb <em>Hello World</em> application.</p> |
|---|
| 59 | |
|---|
| 60 | <p> |
|---|
| 61 | <strong>Who:</strong> |
|---|
| 62 | <input type="text" id="who" size="30" value="Michael"/> |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | <input type="button" value="Say Hello" onclick="clickHello()"/> |
|---|
| 66 | </p> |
|---|
| 67 | </body> |
|---|
| 68 | <hr/> |
|---|
| 69 | </body> |
|---|
| 70 | </html> |
|---|