How does Direct Web Remoting (DWR) work?
Asked Answered
W

1

6

How exactly or what exactly does Direct Web Remoting (DWR) do? While I have already gone through the official site http://directwebremoting.org/ I wanted to understand in simple language..

Specifically I have following questions; 1. While engine.js is standard Javascript library, how exactly does it help in including that in our app ? 2. What is so special about DWR that cannot be done by normal Javascript / AJAx combination?

Thank you.

Windgall answered 24/5, 2011 at 6:24 Comment(0)
T
5

OK, I've only had a brief look at DWR and I was wondering the same thing. As far as I can gather DWR builds and includes on your page some javascript that mirrors your server-side java. It will generate client-side proxies that you can call in your javascript. So instead of using jquerys $.ajax(...) command and specifying the url, data type, data, etc, you can just use RemoveObj.doSomeStuff(...) and it'll do the actual AJAX request for you, behind the scenes.

This is basically what ASP.NET does too when you declare a [WebMethod]. Its simply a shortcut and might save time with maintenance, e.g. if your urls change I suspect DWR will update its client-side code too.

My only issue with this is that it seems to pollute the namespace.

To actually answer your question it does nothing you can't do with normal javascript and servlets.

Tonatonal answered 24/5, 2011 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.