[Dojo-interest] DWR & Dojo

Andrew Scott andrew.scott at aegeon.com.au
Thu Nov 9 16:53:04 MST 2006


Steve,

Ok lets see if I understand DWR correctly.

The DWREngine is the meat and bones to making the Ajax calls, so if I want
to send information to the server I need to do this.

Now DWR is a different kettle of fish I have never played with it, but
DWREngine I have played with and I can tell you for sure you are missing the
point.


So for a typical example of using DWREngine I would first need to do this.

In a function called demo or whatever tickles your fancy.

Demo._path = '/dwr-demo/dwr';
Demo.getServerInfo = function(callback) {
    DWREngine._execute(Demo._path, 'Demo', 'getServerInfo', callback);
}
Now the path is the path to the js libraries, so the mehtod call
getServerInfo is our AJax call to the server, in this example you are
pushing the path and demo to the webservice or file of your choice that is
getServerinfo(). Did you notice that I actually said webservice?

Now in the example that DWR have provided this returns the information back
to the browser and calls the callback function callback. Which all it does
is then populates the field it needs too.

Now lets do the same thing with dojo:-)


dojo.io.bind({
method : 'POST',
content : {
passme: 'I will passed in the url'
},
url: '/webservice/'getServerInfo.cfc',
load: function(type, data, evt) {
 // the calback function where I can do what I need to do
}
},
mimetype: "text/plain"
});
Now because I chose to use a webservice instead, is no big difference, the
problem with DWR is it is a facade to load your class, and you can do that
with minimal requirements in a JSP page anyway.

So the bottom line is I know the DWREngine very well, I used it heavilty
till I moved over to Dojo. It is only upto you and your understanding of
dojo works and how DWR works.

I'll say it again, DWR is a facade that allows you to call a url like any
page would and then have a callback function to do what you want to do.

And how many times do I have to tell you, DWREngine is identical in
functionality as dojo.io.bind and dojo.io.formBind.

It is upto you to open your eyes and see that, but of course you never
looked into how DWR actually works, you see the facade and assume so much
magic, well there might be a little magic but nothing more than calling a
url with paramaters and your url then returning that information back to the
caller. Exaclty the same thing dojo.io.bind does.

As I said I used DWR for about 5-6 years before moving over to Dojo and
there is nothing that dojo can't do that would make me switch back to DWR.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20061109/10b5235b/attachment.html


More information about the Dojo-interest mailing list